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:
zeertzjq
2025-10-04 07:53:29 +08:00
committed by GitHub
parent 2c76a50e20
commit b6b80824cc
9 changed files with 65 additions and 24 deletions

View File

@@ -585,7 +585,8 @@ A closed fold is indicated with a '+'.
These characters can be changed with the 'fillchars' option. These characters can be changed with the 'fillchars' option.
Where the fold column is too narrow to display all nested folds, digits are 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 The mouse can also be used to open and close folds by clicking in the
fold column: fold column:

View File

@@ -285,6 +285,7 @@ OPTIONS
• 'completeopt' flag "nearest" sorts completion results by distance to cursor. • 'completeopt' flag "nearest" sorts completion results by distance to cursor.
• 'diffanchors' specifies addresses to anchor a diff. • 'diffanchors' specifies addresses to anchor a diff.
• 'diffopt' `inline:` configures diff highlighting for changes within a line. • 'diffopt' `inline:` configures diff highlighting for changes within a line.
• 'fillchars' has new flag "foldinner".
• 'grepformat' is now a |global-local| option. • 'grepformat' is now a |global-local| option.
• 'maxsearchcount' sets maximum value for |searchcount()| and defaults to 999. • 'maxsearchcount' sets maximum value for |searchcount()| and defaults to 999.
• 'pummaxwidth' sets maximum width for the completion popup menu. • 'pummaxwidth' sets maximum width for the completion popup menu.

View File

@@ -2860,7 +2860,10 @@ A jump table for the options with a short description can be found at |Q_op|.
fold '·' or '-' filling 'foldtext' fold '·' or '-' filling 'foldtext'
foldopen '-' mark the beginning of a fold foldopen '-' mark the beginning of a fold
foldclose '+' show a closed fold foldclose '+' show a closed fold
foldsep '│' or '|' open fold middle marker 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 diff '-' deleted lines of the 'diff' option
msgsep ' ' message separator 'display' msgsep ' ' message separator 'display'
eob '~' empty lines at the end of a buffer eob '~' empty lines at the end of a buffer

View File

@@ -2578,7 +2578,10 @@ vim.bo.ft = vim.bo.filetype
--- fold '·' or '-' filling 'foldtext' --- fold '·' or '-' filling 'foldtext'
--- foldopen '-' mark the beginning of a fold --- foldopen '-' mark the beginning of a fold
--- foldclose '+' show a closed fold --- foldclose '+' show a closed fold
--- foldsep '│' or '|' open fold middle marker --- 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 --- diff '-' deleted lines of the 'diff' option
--- msgsep ' ' message separator 'display' --- msgsep ' ' message separator 'display'
--- eob '~' empty lines at the end of a buffer --- eob '~' empty lines at the end of a buffer

View File

@@ -1077,6 +1077,7 @@ typedef struct {
schar_T foldopen; ///< when fold is open schar_T foldopen; ///< when fold is open
schar_T foldclosed; ///< when fold is closed schar_T foldclosed; ///< when fold is closed
schar_T foldsep; ///< continuous fold marker schar_T foldsep; ///< continuous fold marker
schar_T foldinner;
schar_T diff; schar_T diff;
schar_T msgsep; schar_T msgsep;
schar_T eob; schar_T eob;

View File

@@ -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; symbol = wp->w_p_fcs_chars.foldopen;
} else if (first_level == 1) { } else if (first_level == 1) {
symbol = wp->w_p_fcs_chars.foldsep; 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) { } else if (first_level + i <= 9) {
symbol = schar_from_ascii('0' + first_level + i); symbol = schar_from_ascii('0' + first_level + i);
} else { } else {

View File

@@ -3261,7 +3261,10 @@ local options = {
fold '·' or '-' filling 'foldtext' fold '·' or '-' filling 'foldtext'
foldopen '-' mark the beginning of a fold foldopen '-' mark the beginning of a fold
foldclose '+' show a closed fold foldclose '+' show a closed fold
foldsep '│' or '|' open fold middle marker 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 diff '-' deleted lines of the 'diff' option
msgsep ' ' message separator 'display' msgsep ' ' message separator 'display'
eob '~' empty lines at the end of a buffer eob '~' empty lines at the end of a buffer

View File

@@ -2246,26 +2246,27 @@ struct chars_tab {
static fcs_chars_T fcs_chars; static fcs_chars_T fcs_chars;
static const struct chars_tab fcs_tab[] = { static const struct chars_tab fcs_tab[] = {
CHARSTAB_ENTRY(&fcs_chars.stl, "stl", " ", NULL), CHARSTAB_ENTRY(&fcs_chars.stl, "stl", " ", NULL),
CHARSTAB_ENTRY(&fcs_chars.stlnc, "stlnc", " ", NULL), CHARSTAB_ENTRY(&fcs_chars.stlnc, "stlnc", " ", NULL),
CHARSTAB_ENTRY(&fcs_chars.wbr, "wbr", " ", NULL), CHARSTAB_ENTRY(&fcs_chars.wbr, "wbr", " ", NULL),
CHARSTAB_ENTRY(&fcs_chars.horiz, "horiz", "", "-"), CHARSTAB_ENTRY(&fcs_chars.horiz, "horiz", "", "-"),
CHARSTAB_ENTRY(&fcs_chars.horizup, "horizup", "", "-"), CHARSTAB_ENTRY(&fcs_chars.horizup, "horizup", "", "-"),
CHARSTAB_ENTRY(&fcs_chars.horizdown, "horizdown", "", "-"), CHARSTAB_ENTRY(&fcs_chars.horizdown, "horizdown", "", "-"),
CHARSTAB_ENTRY(&fcs_chars.vert, "vert", "", "|"), CHARSTAB_ENTRY(&fcs_chars.vert, "vert", "", "|"),
CHARSTAB_ENTRY(&fcs_chars.vertleft, "vertleft", "", "|"), CHARSTAB_ENTRY(&fcs_chars.vertleft, "vertleft", "", "|"),
CHARSTAB_ENTRY(&fcs_chars.vertright, "vertright", "", "|"), CHARSTAB_ENTRY(&fcs_chars.vertright, "vertright", "", "|"),
CHARSTAB_ENTRY(&fcs_chars.verthoriz, "verthoriz", "", "+"), CHARSTAB_ENTRY(&fcs_chars.verthoriz, "verthoriz", "", "+"),
CHARSTAB_ENTRY(&fcs_chars.fold, "fold", "·", "-"), CHARSTAB_ENTRY(&fcs_chars.fold, "fold", "·", "-"),
CHARSTAB_ENTRY(&fcs_chars.foldopen, "foldopen", "-", NULL), CHARSTAB_ENTRY(&fcs_chars.foldopen, "foldopen", "-", NULL),
CHARSTAB_ENTRY(&fcs_chars.foldclosed, "foldclose", "+", NULL), CHARSTAB_ENTRY(&fcs_chars.foldclosed, "foldclose", "+", NULL),
CHARSTAB_ENTRY(&fcs_chars.foldsep, "foldsep", "", "|"), CHARSTAB_ENTRY(&fcs_chars.foldsep, "foldsep", "", "|"),
CHARSTAB_ENTRY(&fcs_chars.diff, "diff", "-", NULL), CHARSTAB_ENTRY(&fcs_chars.foldinner, "foldinner", NULL, NULL),
CHARSTAB_ENTRY(&fcs_chars.msgsep, "msgsep", " ", NULL), CHARSTAB_ENTRY(&fcs_chars.diff, "diff", "-", NULL),
CHARSTAB_ENTRY(&fcs_chars.eob, "eob", "~", NULL), CHARSTAB_ENTRY(&fcs_chars.msgsep, "msgsep", " ", NULL),
CHARSTAB_ENTRY(&fcs_chars.lastline, "lastline", "@", NULL), CHARSTAB_ENTRY(&fcs_chars.eob, "eob", "~", NULL),
CHARSTAB_ENTRY(&fcs_chars.trunc, "trunc", ">", NULL), CHARSTAB_ENTRY(&fcs_chars.lastline, "lastline", "@", NULL),
CHARSTAB_ENTRY(&fcs_chars.truncrl, "truncrl", "<", NULL), CHARSTAB_ENTRY(&fcs_chars.trunc, "trunc", ">", NULL),
CHARSTAB_ENTRY(&fcs_chars.truncrl, "truncrl", "<", NULL),
}; };
static lcs_chars_T lcs_chars; static lcs_chars_T lcs_chars;

View File

@@ -343,6 +343,32 @@ func Test_fold_fillchars()
\ ] \ ]
call assert_equal(expected, lines) 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! %bw!
set fillchars& fdc& foldmethod& foldenable& set fillchars& fdc& foldmethod& foldenable&
endfunc endfunc