patch 9.0.1710: scrolloff options work slightly different

Problem: sidescrolloff and scrolloff options work slightly
         different than other global-local options
Solution: Make it behave consistent for all global-local options

It was noticed, that sidescrolloff and scrolloff options behave
differently in comparison to other global-local window options like
'listchars'

So make those two behave like other global-local options. Also add some
extra documentation for a few special local-window options.

Add a few tests to make sure all global-local window options behave
similar

closes: #12956
closes: #12643

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2023-08-13 19:43:42 +02:00
parent e5e4709a6a
commit 4a8eb6e7a9
7 changed files with 133 additions and 15 deletions

View File

@ -252,6 +252,8 @@ opt+=val" the expansion is done before the adding or removing.
Handling of local options *local-options*
Note: The following also applies to |global-local| options.
Some of the options only apply to a window or buffer. Each window or buffer
has its own copy of this option, thus each can have its own value. This
allows you to set 'list' in one window but not in another. And set
@ -301,6 +303,30 @@ The options local to a window are remembered for each buffer. This also
happens when the buffer is not loaded, but they are lost when the buffer is
wiped out |:bwipe|.
Special local window options *special-local-window-option*
The following local window options won't be copied over when new windows are
created, thus they behave slightly differently:
Option Reason ~
'previewwindow' there can only be a single one
'scroll' specific to existing window
'winfixheight' specific to existing window
'winfixwidth' specific to existing window
Special local buffer options *special-local-buffer-option*
The following local buffer options won't be copied over when new buffers are
created, thus they behave slightly differently:
Option Reason ~
'filetype' explicitly set by autocommands
'syntax' explicitly set by autocommands
'bufhidden' denote |special-buffers|
'buftype' denote |special-buffers|
'readonly' will be detected automatically
'modified' will be detected automatically
*:setl* *:setlocal*
:setl[ocal][!] ... Like ":set" but set only the value local to the
current buffer or window. Not all options have a
@ -374,7 +400,6 @@ used. Thus it does the same as: >
Note: In the future more global options can be made |global-local|. Using
":setlocal" on a global option might work differently then.
*option-value-function*
Some options ('completefunc', 'imactivatefunc', 'imstatusfunc', 'omnifunc',
'operatorfunc', 'quickfixtextfunc', 'tagfunc' and 'thesaurusfunc') are set to
@ -1449,7 +1474,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'bufhidden'* *'bh'*
'bufhidden' 'bh' string (default: "")
local to buffer
local to buffer |special-local-buffer-option|
This option specifies what happens when a buffer is no longer
displayed in a window:
<empty> follow the global 'hidden' option
@ -1481,7 +1506,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'buftype'* *'bt'* *E382*
'buftype' 'bt' string (default: "")
local to buffer
local to buffer |special-local-buffer-option|
The value of this option specifies the type of a buffer:
<empty> normal buffer
nofile buffer which is not related to a file and will not be
@ -3408,7 +3433,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'filetype'* *'ft'*
'filetype' 'ft' string (default: "")
local to buffer
local to buffer |special-local-buffer-option|
When this option is set, the FileType autocommand event is triggered.
All autocommands that match with the value of this option will be
executed. Thus the value of 'filetype' is used in place of the file
@ -5565,7 +5590,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'modified'* *'mod'* *'nomodified'* *'nomod'*
'modified' 'mod' boolean (default off)
local to buffer
local to buffer |special-local-buffer-option|
When on, the buffer is considered to be modified. This option is set
when:
1. A change was made to the text since it was last written. Using the
@ -6136,7 +6161,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'previewwindow'* *'nopreviewwindow'*
*'pvw'* *'nopvw'* *E590*
'previewwindow' 'pvw' boolean (default off)
local to window
local to window |special-local-window-option|
{not available when compiled without the |+quickfix|
feature}
Identifies the preview window. Only one window can have this option
@ -6331,7 +6356,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'readonly'* *'ro'* *'noreadonly'* *'noro'*
'readonly' 'ro' boolean (default off)
local to buffer
local to buffer |special-local-buffer-option|
If on, writes fail unless you use a '!'. Protects you from
accidentally overwriting a file. Default on when Vim is started
in read-only mode ("vim -R") or when the executable is called "view".
@ -6710,7 +6735,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'scroll'* *'scr'*
'scroll' 'scr' number (default: half the window height)
local to window
local to window |special-local-window-option|
Number of lines to scroll with CTRL-U and CTRL-D commands. Will be
set to half the number of lines in the window when the window size
changes. This may happen when enabling the |status-line| or
@ -7972,7 +7997,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'syntax'* *'syn'*
'syntax' 'syn' string (default empty)
local to buffer
local to buffer |special-local-buffer-option|
{not available when compiled without the |+syntax|
feature}
When this option is set, the syntax with this name is loaded, unless
@ -9420,7 +9445,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'winfixheight'* *'wfh'* *'nowinfixheight'* *'nowfh'*
'winfixheight' 'wfh' boolean (default off)
local to window
local to window |special-local-window-option|
Keep the window height when windows are opened or closed and
'equalalways' is set. Also for |CTRL-W_=|. Set by default for the
|preview-window| and |quickfix-window|.
@ -9428,7 +9453,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'winfixwidth'* *'wfw'* *'nowinfixwidth'* *'nowfw'*
'winfixwidth' 'wfw' boolean (default off)
local to window
local to window |special-local-window-option|
Keep the window width when windows are opened or closed and
'equalalways' is set. Also for |CTRL-W_=|.
The width may be changed anyway when running out of room.