mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
vim-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: vim/vim#12956
closes: vim/vim#12643
4a8eb6e7a9
Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@ -542,6 +542,36 @@ local function scope_to_doc(s)
|
||||
return 'global or '..m[s[2]]..' |global-local|'
|
||||
end
|
||||
|
||||
-- @param o vim.option_meta
|
||||
-- @return string
|
||||
local function scope_more_doc(o)
|
||||
if
|
||||
vim.list_contains({
|
||||
'previewwindow',
|
||||
'scroll',
|
||||
'winfixheight',
|
||||
'winfixwidth',
|
||||
}, o.full_name)
|
||||
then
|
||||
return ' |special-local-window-option|'
|
||||
end
|
||||
|
||||
if
|
||||
vim.list_contains({
|
||||
'bufhidden',
|
||||
'buftype',
|
||||
'filetype',
|
||||
'modified',
|
||||
'readonly',
|
||||
'syntax',
|
||||
}, o.full_name)
|
||||
then
|
||||
return ' |special-local-buffer-option|'
|
||||
end
|
||||
|
||||
return ''
|
||||
end
|
||||
|
||||
--- @return table<string,vim.option_meta>
|
||||
local function get_option_meta()
|
||||
local opts = require('src/nvim/options').options
|
||||
@ -624,7 +654,7 @@ local function render_option_doc(_f, opt, write)
|
||||
write(string.format('%s\t%s', name_str, otype))
|
||||
end
|
||||
|
||||
write('\t\t\t'..scope_to_doc(opt.scope))
|
||||
write('\t\t\t'..scope_to_doc(opt.scope)..scope_more_doc(opt))
|
||||
for _, l in ipairs(split(opt.desc)) do
|
||||
if l == '<' or l:match('^<%s') then
|
||||
write(l)
|
||||
|
Reference in New Issue
Block a user