Skip to content

Commit 96ba25a

Browse files
committed
patch 9.0.0036: 'fillchars' cannot have window-local values
Problem: 'fillchars' cannot have window-local values. Solution: Make 'fillchars' global-local. (closes #5206)
1 parent 54e5fed commit 96ba25a

19 files changed

Lines changed: 276 additions & 143 deletions

runtime/doc/options.txt

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3376,22 +3376,24 @@ A jump table for the options with a short description can be found at |Q_op|.
33763376

33773377
*'fillchars'* *'fcs'*
33783378
'fillchars' 'fcs' string (default "vert:|,fold:-,eob:~")
3379-
global
3379+
global or local to window |global-local|
33803380
{not available when compiled without the |+folding|
33813381
feature}
3382-
Characters to fill the statuslines and vertical separators.
3383-
It is a comma-separated list of items:
3384-
3385-
item default Used for ~
3386-
stl:c ' ' or '^' statusline of the current window
3387-
stlnc:c ' ' or '=' statusline of the non-current windows
3388-
vert:c '|' vertical separators |:vsplit|
3389-
fold:c '-' filling 'foldtext'
3390-
foldopen:c '-' mark the beginning of a fold
3391-
foldclose:c '+' show a closed fold
3392-
foldsep:c '|' open fold middle character
3393-
diff:c '-' deleted lines of the 'diff' option
3394-
eob:c '~' empty lines below the end of a buffer
3382+
Characters to fill the statuslines, vertical separators and special
3383+
lines in the window.
3384+
It is a comma-separated list of items. Each item has a name, a colon
3385+
and the value of that item:
3386+
3387+
item name default Used for ~
3388+
stl ' ' or '^' statusline of the current window
3389+
stlnc ' ' or '=' statusline of the non-current windows
3390+
vert '|' vertical separators |:vsplit|
3391+
fold '-' filling 'foldtext'
3392+
foldopen '-' mark the beginning of a fold
3393+
foldclose '+' show a closed fold
3394+
foldsep '|' open fold middle character
3395+
diff '-' deleted lines of the 'diff' option
3396+
eob '~' empty lines below the end of a buffer
33953397

33963398
Any one that is omitted will fall back to the default. For "stl" and
33973399
"stlnc" the space will be used when there is highlighting, '^' or '='
@@ -3407,13 +3409,13 @@ A jump table for the options with a short description can be found at |Q_op|.
34073409
characters are not supported.
34083410

34093411
The highlighting used for these items:
3410-
item highlight group ~
3411-
stl:c StatusLine |hl-StatusLine|
3412-
stlnc:c StatusLineNC |hl-StatusLineNC|
3413-
vert:c VertSplit |hl-VertSplit|
3414-
fold:c Folded |hl-Folded|
3415-
diff:c DiffDelete |hl-DiffDelete|
3416-
eob:c EndOfBuffer |hl-EndOfBuffer|
3412+
item name highlight group ~
3413+
stl StatusLine |hl-StatusLine|
3414+
stlnc StatusLineNC |hl-StatusLineNC|
3415+
vert VertSplit |hl-VertSplit|
3416+
fold Folded |hl-Folded|
3417+
diff DiffDelete |hl-DiffDelete|
3418+
eob EndOfBuffer |hl-EndOfBuffer|
34173419

34183420
*'fixendofline'* *'fixeol'* *'nofixendofline'* *'nofixeol'*
34193421
'fixendofline' 'fixeol' boolean (default on)

src/drawline.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,14 +1268,14 @@ win_line(
12681268
if (filler_todo > 0)
12691269
{
12701270
// Draw "deleted" diff line(s).
1271-
if (char2cells(fill_diff) > 1)
1271+
if (char2cells(wp->w_fill_chars.diff) > 1)
12721272
{
12731273
c_extra = '-';
12741274
c_final = NUL;
12751275
}
12761276
else
12771277
{
1278-
c_extra = fill_diff;
1278+
c_extra = wp->w_fill_chars.diff;
12791279
c_final = NUL;
12801280
}
12811281
# ifdef FEAT_RIGHTLEFT
@@ -1352,7 +1352,7 @@ win_line(
13521352
#endif
13531353
)
13541354
{
1355-
screen_line(screen_row, wp->w_wincol, col, -wp->w_width,
1355+
screen_line(wp, screen_row, wp->w_wincol, col, -wp->w_width,
13561356
screen_line_flags);
13571357
// Pretend we have finished updating the window. Except when
13581358
// 'cursorcolumn' is set.
@@ -2859,7 +2859,7 @@ win_line(
28592859
}
28602860
#endif
28612861

2862-
screen_line(screen_row, wp->w_wincol, col,
2862+
screen_line(wp, screen_row, wp->w_wincol, col,
28632863
wp->w_width, screen_line_flags);
28642864
row++;
28652865

@@ -3160,11 +3160,11 @@ win_line(
31603160
)
31613161
{
31623162
#ifdef FEAT_CONCEAL
3163-
screen_line(screen_row, wp->w_wincol, col - boguscols,
3163+
screen_line(wp, screen_row, wp->w_wincol, col - boguscols,
31643164
wp->w_width, screen_line_flags);
31653165
boguscols = 0;
31663166
#else
3167-
screen_line(screen_row, wp->w_wincol, col,
3167+
screen_line(wp, screen_row, wp->w_wincol, col,
31683168
wp->w_width, screen_line_flags);
31693169
#endif
31703170
++row;

src/drawscreen.c

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED)
555555
if (stl_connected(wp))
556556
fillchar = fillchar_status(&attr, wp);
557557
else
558-
fillchar = fillchar_vsep(&attr);
558+
fillchar = fillchar_vsep(&attr, wp);
559559
screen_putchar(fillchar, row, W_ENDCOL(wp), attr);
560560
}
561561
busy = FALSE;
@@ -1038,7 +1038,7 @@ redraw_win_toolbar(win_T *wp)
10381038
}
10391039
wp->w_winbar_items[item_idx].wb_menu = NULL; // end marker
10401040

1041-
screen_line(wp->w_winrow, wp->w_wincol, wp->w_width, wp->w_width, 0);
1041+
screen_line(wp, wp->w_winrow, wp->w_wincol, wp->w_width, wp->w_width, 0);
10421042
}
10431043
#endif
10441044

@@ -1246,7 +1246,8 @@ fold_line(
12461246

12471247
txtcol = col; // remember where text starts
12481248

1249-
// 5. move the text to current_ScreenLine. Fill up with "fill_fold".
1249+
// 5. move the text to current_ScreenLine. Fill up with "fold" from
1250+
// 'fillchars'.
12501251
// Right-left text is put in columns 0 - number-col, normal text is put
12511252
// in columns number-col - window-width.
12521253
col = text_to_screenline(wp, text, col);
@@ -1262,23 +1263,25 @@ fold_line(
12621263
#endif
12631264
)
12641265
{
1266+
int c = wp->w_fill_chars.fold;
1267+
12651268
if (enc_utf8)
12661269
{
1267-
if (fill_fold >= 0x80)
1270+
if (c >= 0x80)
12681271
{
1269-
ScreenLinesUC[off + col] = fill_fold;
1272+
ScreenLinesUC[off + col] = c;
12701273
ScreenLinesC[0][off + col] = 0;
12711274
ScreenLines[off + col] = 0x80; // avoid storing zero
12721275
}
12731276
else
12741277
{
12751278
ScreenLinesUC[off + col] = 0;
1276-
ScreenLines[off + col] = fill_fold;
1279+
ScreenLines[off + col] = c;
12771280
}
12781281
col++;
12791282
}
12801283
else
1281-
ScreenLines[off + col++] = fill_fold;
1284+
ScreenLines[off + col++] = c;
12821285
}
12831286

12841287
if (text != buf)
@@ -1371,7 +1374,8 @@ fold_line(
13711374
}
13721375
#endif
13731376

1374-
screen_line(row + W_WINROW(wp), wp->w_wincol, wp->w_width, wp->w_width, 0);
1377+
screen_line(wp, row + W_WINROW(wp), wp->w_wincol,
1378+
wp->w_width, wp->w_width, 0);
13751379

13761380
// Update w_cline_height and w_cline_folded if the cursor line was
13771381
// updated (saves a call to plines() later).
@@ -2669,10 +2673,10 @@ win_update(win_T *wp)
26692673
if (j > 0 && !wp->w_botfill)
26702674
{
26712675
// Display filler lines at the end of the file.
2672-
if (char2cells(fill_diff) > 1)
2676+
if (char2cells(wp->w_fill_chars.diff) > 1)
26732677
i = '-';
26742678
else
2675-
i = fill_diff;
2679+
i = wp->w_fill_chars.diff;
26762680
if (row + j > wp->w_height)
26772681
j = wp->w_height - row;
26782682
win_draw_end(wp, i, i, TRUE, row, row + (int)j, HLF_DED);
@@ -2683,12 +2687,14 @@ win_update(win_T *wp)
26832687
else if (dollar_vcol == -1)
26842688
wp->w_botline = lnum;
26852689

2686-
// Make sure the rest of the screen is blank
2687-
// write the 'fill_eob' character to rows that aren't part of the file
2690+
// Make sure the rest of the screen is blank.
2691+
// write the "eob" character from 'fillchars' to rows that aren't part
2692+
// of the file.
26882693
if (WIN_IS_POPUP(wp))
26892694
win_draw_end(wp, ' ', ' ', FALSE, row, wp->w_height, HLF_AT);
26902695
else
2691-
win_draw_end(wp, fill_eob, ' ', FALSE, row, wp->w_height, HLF_EOB);
2696+
win_draw_end(wp, wp->w_fill_chars.eob, ' ', FALSE,
2697+
row, wp->w_height, HLF_EOB);
26922698
}
26932699

26942700
#ifdef SYN_TIME_LIMIT
@@ -3026,7 +3032,7 @@ redraw_asap(int type)
30263032
mch_memmove(ScreenLines2 + off,
30273033
screenline2 + r * cols,
30283034
(size_t)cols * sizeof(schar_T));
3029-
screen_line(cmdline_row + r, 0, cols, cols, 0);
3035+
screen_line(curwin, cmdline_row + r, 0, cols, cols, 0);
30303036
}
30313037
ret = 4;
30323038
}

src/globals.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,17 +1380,6 @@ EXTERN char_u *homedir INIT(= NULL);
13801380
// directory is not a local directory, globaldir is NULL.
13811381
EXTERN char_u *globaldir INIT(= NULL);
13821382

1383-
// Characters from 'fillchars' option
1384-
EXTERN int fill_stl INIT(= ' ');
1385-
EXTERN int fill_stlnc INIT(= ' ');
1386-
EXTERN int fill_vert INIT(= ' ');
1387-
EXTERN int fill_fold INIT(= '-');
1388-
EXTERN int fill_foldopen INIT(= '-');
1389-
EXTERN int fill_foldclosed INIT(= '+');
1390-
EXTERN int fill_foldsep INIT(= '|');
1391-
EXTERN int fill_diff INIT(= '-');
1392-
EXTERN int fill_eob INIT(= '~');
1393-
13941383
#ifdef FEAT_FOLDING
13951384
EXTERN int disable_fold_update INIT(= 0);
13961385
#endif

src/mbyte.c

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4229,8 +4229,7 @@ utf_find_illegal(void)
42294229
#if defined(FEAT_GUI_GTK) || defined(FEAT_SPELL) || defined(PROTO)
42304230
/*
42314231
* Return TRUE if string "s" is a valid utf-8 string.
4232-
* When "end" is NULL stop at the first NUL.
4233-
* When "end" is positive stop there.
4232+
* When "end" is NULL stop at the first NUL. Otherwise stop at "end".
42344233
*/
42354234
int
42364235
utf_valid_string(char_u *s, char_u *end)
@@ -5529,6 +5528,7 @@ f_setcellwidths(typval_T *argvars, typval_T *rettv UNUSED)
55295528
cw_interval_T *table;
55305529
cw_interval_T *cw_table_save;
55315530
size_t cw_table_size_save;
5531+
char *error = NULL;
55325532

55335533
if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
55345534
return;
@@ -5648,30 +5648,36 @@ f_setcellwidths(typval_T *argvars, typval_T *rettv UNUSED)
56485648
// Check that the new value does not conflict with 'fillchars' or
56495649
// 'listchars'.
56505650
if (set_chars_option(curwin, &p_fcs) != NULL)
5651-
{
5652-
emsg(_(e_conflicts_with_value_of_fillchars));
5653-
cw_table = cw_table_save;
5654-
cw_table_size = cw_table_size_save;
5655-
vim_free(table);
5656-
return;
5657-
}
5651+
error = e_conflicts_with_value_of_fillchars;
5652+
else if (set_chars_option(curwin, &p_lcs) != NULL)
5653+
error = e_conflicts_with_value_of_listchars;
56585654
else
56595655
{
5660-
tabpage_T *tp;
5661-
win_T *wp;
5656+
tabpage_T *tp;
5657+
win_T *wp;
56625658

56635659
FOR_ALL_TAB_WINDOWS(tp, wp)
56645660
{
56655661
if (set_chars_option(wp, &wp->w_p_lcs) != NULL)
56665662
{
5667-
emsg((e_conflicts_with_value_of_listchars));
5668-
cw_table = cw_table_save;
5669-
cw_table_size = cw_table_size_save;
5670-
vim_free(table);
5671-
return;
5663+
error = e_conflicts_with_value_of_listchars;
5664+
break;
5665+
}
5666+
if (set_chars_option(wp, &wp->w_p_fcs) != NULL)
5667+
{
5668+
error = e_conflicts_with_value_of_fillchars;
5669+
break;
56725670
}
56735671
}
56745672
}
5673+
if (error != NULL)
5674+
{
5675+
emsg(_(error));
5676+
cw_table = cw_table_save;
5677+
cw_table_size = cw_table_size_save;
5678+
vim_free(table);
5679+
return;
5680+
}
56755681

56765682
vim_free(cw_table_save);
56775683
}

src/mouse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2018,7 +2018,7 @@ jump_to_mouse(
20182018
count |= CURSOR_MOVED; // Cursor has moved
20192019

20202020
# ifdef FEAT_FOLDING
2021-
if (mouse_char == fill_foldclosed)
2021+
if (mouse_char == curwin->w_fill_chars.foldclosed)
20222022
count |= MOUSE_FOLD_OPEN;
20232023
else if (mouse_char != ' ')
20242024
count |= MOUSE_FOLD_CLOSE;

0 commit comments

Comments
 (0)