mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 17:36:29 +00:00
vim-patch:9.1.1819: Cannot configure the inner foldlevel indicator (#36010)
Problem: Cannot configure the inner foldlevel indicator for the
foldcolumn
Solution: Add "foldinner" suboption value to the 'fillchar' option
(Maria José Solano).
closes: vim/vim#18365
1a691afd27
Co-authored-by: Maria José Solano <majosolano99@gmail.com>
This commit is contained in:
@@ -585,7 +585,8 @@ A closed fold is indicated with a '+'.
|
||||
These characters can be changed with the 'fillchars' option.
|
||||
|
||||
Where the fold column is too narrow to display all nested folds, digits are
|
||||
shown to indicate the nesting level.
|
||||
shown to indicate the nesting level. To override this behavior you can use
|
||||
the "foldinner" character of the 'fillchars' option.
|
||||
|
||||
The mouse can also be used to open and close folds by clicking in the
|
||||
fold column:
|
||||
|
@@ -285,6 +285,7 @@ OPTIONS
|
||||
• 'completeopt' flag "nearest" sorts completion results by distance to cursor.
|
||||
• 'diffanchors' specifies addresses to anchor a diff.
|
||||
• 'diffopt' `inline:` configures diff highlighting for changes within a line.
|
||||
• 'fillchars' has new flag "foldinner".
|
||||
• 'grepformat' is now a |global-local| option.
|
||||
• 'maxsearchcount' sets maximum value for |searchcount()| and defaults to 999.
|
||||
• 'pummaxwidth' sets maximum width for the completion popup menu.
|
||||
|
@@ -2861,6 +2861,9 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
foldopen '-' mark the beginning of a fold
|
||||
foldclose '+' show a closed fold
|
||||
foldsep '│' or '|' open fold middle marker
|
||||
foldinner none character to show instead of the
|
||||
numeric foldlevel when it would be
|
||||
repeated in a narrow 'foldcolumn'
|
||||
diff '-' deleted lines of the 'diff' option
|
||||
msgsep ' ' message separator 'display'
|
||||
eob '~' empty lines at the end of a buffer
|
||||
|
3
runtime/lua/vim/_meta/options.lua
generated
3
runtime/lua/vim/_meta/options.lua
generated
@@ -2579,6 +2579,9 @@ vim.bo.ft = vim.bo.filetype
|
||||
--- foldopen '-' mark the beginning of a fold
|
||||
--- foldclose '+' show a closed fold
|
||||
--- foldsep '│' or '|' open fold middle marker
|
||||
--- foldinner none character to show instead of the
|
||||
--- numeric foldlevel when it would be
|
||||
--- repeated in a narrow 'foldcolumn'
|
||||
--- diff '-' deleted lines of the 'diff' option
|
||||
--- msgsep ' ' message separator 'display'
|
||||
--- eob '~' empty lines at the end of a buffer
|
||||
|
@@ -1077,6 +1077,7 @@ typedef struct {
|
||||
schar_T foldopen; ///< when fold is open
|
||||
schar_T foldclosed; ///< when fold is closed
|
||||
schar_T foldsep; ///< continuous fold marker
|
||||
schar_T foldinner;
|
||||
schar_T diff;
|
||||
schar_T msgsep;
|
||||
schar_T eob;
|
||||
|
@@ -517,6 +517,8 @@ void fill_foldcolumn(win_T *wp, foldinfo_T foldinfo, linenr_T lnum, int attr, in
|
||||
symbol = wp->w_p_fcs_chars.foldopen;
|
||||
} else if (first_level == 1) {
|
||||
symbol = wp->w_p_fcs_chars.foldsep;
|
||||
} else if (wp->w_p_fcs_chars.foldinner != NUL) {
|
||||
symbol = wp->w_p_fcs_chars.foldinner;
|
||||
} else if (first_level + i <= 9) {
|
||||
symbol = schar_from_ascii('0' + first_level + i);
|
||||
} else {
|
||||
|
@@ -3262,6 +3262,9 @@ local options = {
|
||||
foldopen '-' mark the beginning of a fold
|
||||
foldclose '+' show a closed fold
|
||||
foldsep '│' or '|' open fold middle marker
|
||||
foldinner none character to show instead of the
|
||||
numeric foldlevel when it would be
|
||||
repeated in a narrow 'foldcolumn'
|
||||
diff '-' deleted lines of the 'diff' option
|
||||
msgsep ' ' message separator 'display'
|
||||
eob '~' empty lines at the end of a buffer
|
||||
|
@@ -2260,6 +2260,7 @@ static const struct chars_tab fcs_tab[] = {
|
||||
CHARSTAB_ENTRY(&fcs_chars.foldopen, "foldopen", "-", NULL),
|
||||
CHARSTAB_ENTRY(&fcs_chars.foldclosed, "foldclose", "+", NULL),
|
||||
CHARSTAB_ENTRY(&fcs_chars.foldsep, "foldsep", "│", "|"),
|
||||
CHARSTAB_ENTRY(&fcs_chars.foldinner, "foldinner", NULL, NULL),
|
||||
CHARSTAB_ENTRY(&fcs_chars.diff, "diff", "-", NULL),
|
||||
CHARSTAB_ENTRY(&fcs_chars.msgsep, "msgsep", " ", NULL),
|
||||
CHARSTAB_ENTRY(&fcs_chars.eob, "eob", "~", NULL),
|
||||
|
@@ -343,6 +343,32 @@ func Test_fold_fillchars()
|
||||
\ ]
|
||||
call assert_equal(expected, lines)
|
||||
|
||||
" check setting foldinner
|
||||
set fdc=1 foldmethod=indent foldlevel=10
|
||||
call setline(1, ['one', ' two', ' two', ' three', ' three', 'four'])
|
||||
let lines = ScreenLines([1, 6], 22)
|
||||
let expected = [
|
||||
\ ' one ',
|
||||
\ '[ two ',
|
||||
\ '- two ',
|
||||
\ '[ three',
|
||||
\ '2 three',
|
||||
\ ' four ',
|
||||
\ ]
|
||||
call assert_equal(expected, lines)
|
||||
|
||||
set fillchars+=foldinner:\
|
||||
let lines = ScreenLines([1, 6], 22)
|
||||
let expected = [
|
||||
\ ' one ',
|
||||
\ '[ two ',
|
||||
\ '- two ',
|
||||
\ '[ three',
|
||||
\ ' three',
|
||||
\ ' four ',
|
||||
\ ]
|
||||
call assert_equal(expected, lines)
|
||||
|
||||
%bw!
|
||||
set fillchars& fdc& foldmethod& foldenable&
|
||||
endfunc
|
||||
|
Reference in New Issue
Block a user