From 0ba27bb51d3297aec43e78050cc3adcf6879db22 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 23 Aug 2023 16:32:15 +0800 Subject: 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 https://github.com/vim/vim/commit/4a8eb6e7a9df10f79bf95301ced012f0d6a13088 Co-authored-by: Christian Brabandt --- scripts/gen_eval_files.lua | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'scripts/gen_eval_files.lua') diff --git a/scripts/gen_eval_files.lua b/scripts/gen_eval_files.lua index 9bc9e99c46..2990eef069 100755 --- a/scripts/gen_eval_files.lua +++ b/scripts/gen_eval_files.lua @@ -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 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) -- cgit