aboutsummaryrefslogtreecommitdiff
path: root/src/nvim
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-20 15:20:42 -0500
committerGitHub <noreply@github.com>2020-12-20 15:20:42 -0500
commitb1711e6f922598f00c4d2c879094afdbba44c187 (patch)
treeda82e73ae568899dcd9c5ca1eb74ce09671e9fef /src/nvim
parentabcbc5a9f346f98591f27eb73bc1c63787779368 (diff)
downloadrneovim-b1711e6f922598f00c4d2c879094afdbba44c187.tar.gz
rneovim-b1711e6f922598f00c4d2c879094afdbba44c187.tar.bz2
rneovim-b1711e6f922598f00c4d2c879094afdbba44c187.zip
foldcolumn: support "auto" (#13571)
"set foldcolumn=auto" is documented but not supported. Support it by making it behave as "auto:1", similar to "signcolumn". Close https://github.com/neovim/neovim/pull/13561
Diffstat (limited to 'src/nvim')
-rw-r--r--src/nvim/option.c2
-rw-r--r--src/nvim/window.c7
2 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 7cf8412269..bac289a959 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -320,7 +320,7 @@ static char *(p_scl_values[]) = { "yes", "no", "auto", "auto:1", "auto:2",
"auto:3", "auto:4", "auto:5", "auto:6", "auto:7", "auto:8", "auto:9",
"yes:1", "yes:2", "yes:3", "yes:4", "yes:5", "yes:6", "yes:7", "yes:8",
"yes:9", "number", NULL };
-static char *(p_fdc_values[]) = { "auto:1", "auto:2",
+static char *(p_fdc_values[]) = { "auto", "auto:1", "auto:2",
"auto:3", "auto:4", "auto:5", "auto:6", "auto:7", "auto:8", "auto:9",
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 9eb16e67ec..0f17e2cb09 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -641,7 +641,7 @@ void win_set_minimal_style(win_T *wp)
wp->w_p_scl = (char_u *)xstrdup("auto");
}
- // foldcolumn: use 'auto'
+ // foldcolumn: use '0'
if (wp->w_p_fdc[0] != '0') {
xfree(wp->w_p_fdc);
wp->w_p_fdc = (char_u *)xstrdup("0");
@@ -700,9 +700,10 @@ int win_fdccol_count(win_T *wp)
const char *fdc = (const char *)wp->w_p_fdc;
// auto:<NUM>
- if (strncmp(fdc, "auto:", 5) == 0) {
+ if (strncmp(fdc, "auto", 4) == 0) {
+ const int fdccol = fdc[4] == ':' ? fdc[5] - '0' : 1;
int needed_fdccols = getDeepestNesting(wp);
- return MIN(fdc[5] - '0', needed_fdccols);
+ return MIN(fdccol, needed_fdccols);
} else {
return fdc[0] - '0';
}