mirror of
https://github.com/neovim/neovim.git
synced 2025-10-09 19:36:40 +00:00
foldcolumn: allow auto:X
Similar to signcolumn, allow foldcolumn to adapt itself to the number of folds. Regression: vim supports a maximum fdc of 12, this limits it to 9.
This commit is contained in:
@@ -618,7 +618,6 @@ void win_set_minimal_style(win_T *wp)
|
||||
wp->w_p_cuc = false;
|
||||
wp->w_p_spell = false;
|
||||
wp->w_p_list = false;
|
||||
wp->w_p_fdc = 0;
|
||||
|
||||
// Hide EOB region: use " " fillchar and cleared highlighting
|
||||
if (wp->w_p_fcs_chars.eob != ' ') {
|
||||
@@ -642,6 +641,12 @@ void win_set_minimal_style(win_T *wp)
|
||||
wp->w_p_scl = (char_u *)xstrdup("auto");
|
||||
}
|
||||
|
||||
// foldcolumn: use 'auto'
|
||||
if (wp->w_p_fdc[0] != '0') {
|
||||
xfree(wp->w_p_fdc);
|
||||
wp->w_p_fdc = (char_u *)xstrdup("0");
|
||||
}
|
||||
|
||||
// colorcolumn: cleared
|
||||
if (wp->w_p_cc != NULL && *wp->w_p_cc != NUL) {
|
||||
xfree(wp->w_p_cc);
|
||||
@@ -689,6 +694,24 @@ void win_check_anchored_floats(win_T *win)
|
||||
}
|
||||
}
|
||||
|
||||
/// Return the number of requested fold columns, based on current
|
||||
/// folds signs and on user configuration.
|
||||
int win_fdccol_count(win_T *wp)
|
||||
{
|
||||
const char *fdc = (const char *)wp->w_p_fdc;
|
||||
|
||||
// auto:<NUM>
|
||||
if (strncmp(fdc, "auto:", 5) == 0) {
|
||||
int needed_fdccols;
|
||||
needed_fdccols = getDeepestNesting(wp);
|
||||
int maximum = fdc[5] - '0';
|
||||
return MIN(maximum, needed_fdccols);
|
||||
} else {
|
||||
return fdc[0] - '0';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void ui_ext_win_position(win_T *wp)
|
||||
{
|
||||
if (!wp->w_floating) {
|
||||
|
Reference in New Issue
Block a user