Skip to content

Commit d7dc01a

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 58064dc + 608d78f commit d7dc01a

28 files changed

+321
-58
lines changed

runtime/doc/options.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3277,7 +3277,8 @@ A jump table for the options with a short description can be found at |Q_op|.
32773277
< This is similar to the default, except that these characters will also
32783278
be used when there is highlighting.
32793279

3280-
for "stl" and "stlnc" only single-byte values are supported.
3280+
For "stl" and "stlnc" single-byte and multibyte characters are
3281+
supported. But double-width characters are not supported.
32813282

32823283
The highlighting used for these items:
32833284
item highlight group ~

src/buffer.c

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4167,9 +4167,6 @@ build_stl_str_hl(
41674167

41684168
if (fillchar == 0)
41694169
fillchar = ' ';
4170-
// Can't handle a multi-byte fill character yet.
4171-
else if (mb_char2len(fillchar) > 1)
4172-
fillchar = '-';
41734170

41744171
// The cursor in windows other than the current one isn't always
41754172
// up-to-date, esp. because of autocommands and timers.
@@ -4345,7 +4342,7 @@ build_stl_str_hl(
43454342

43464343
// Fill up space left over by half a double-wide char.
43474344
while (++l < stl_items[stl_groupitem[groupdepth]].stl_minwid)
4348-
*p++ = fillchar;
4345+
MB_CHAR2BYTES(fillchar, p);
43494346

43504347
// correct the start of the items for the truncation
43514348
for (l = stl_groupitem[groupdepth] + 1; l < curitem; l++)
@@ -4364,20 +4361,20 @@ build_stl_str_hl(
43644361
// fill by appending characters
43654362
n = 0 - n;
43664363
while (l++ < n && p + 1 < out + outlen)
4367-
*p++ = fillchar;
4364+
MB_CHAR2BYTES(fillchar, p);
43684365
}
43694366
else
43704367
{
43714368
// fill by inserting characters
4372-
mch_memmove(t + n - l, t, (size_t)(p - t));
4373-
l = n - l;
4369+
l = (n - l) * MB_CHAR2LEN(fillchar);
4370+
mch_memmove(t + l, t, (size_t)(p - t));
43744371
if (p + l >= out + outlen)
43754372
l = (long)((out + outlen) - p - 1);
43764373
p += l;
43774374
for (n = stl_groupitem[groupdepth] + 1; n < curitem; n++)
43784375
stl_items[n].stl_start += l;
43794376
for ( ; l > 0; l--)
4380-
*t++ = fillchar;
4377+
MB_CHAR2BYTES(fillchar, t);
43814378
}
43824379
}
43834380
continue;
@@ -4756,23 +4753,24 @@ build_stl_str_hl(
47564753
if (l + 1 == minwid && fillchar == '-' && VIM_ISDIGIT(*t))
47574754
*p++ = ' ';
47584755
else
4759-
*p++ = fillchar;
4756+
MB_CHAR2BYTES(fillchar, p);
47604757
}
47614758
minwid = 0;
47624759
}
47634760
else
47644761
minwid *= -1;
4765-
while (*t && p + 1 < out + outlen)
4762+
for (; *t && p + 1 < out + outlen; t++)
47664763
{
4767-
*p++ = *t++;
47684764
// Change a space by fillchar, unless fillchar is '-' and a
47694765
// digit follows.
4770-
if (fillable && p[-1] == ' '
4771-
&& (!VIM_ISDIGIT(*t) || fillchar != '-'))
4772-
p[-1] = fillchar;
4766+
if (fillable && *t == ' '
4767+
&& (!VIM_ISDIGIT(*(t + 1)) || fillchar != '-'))
4768+
MB_CHAR2BYTES(fillchar, p);
4769+
else
4770+
*p++ = *t;
47734771
}
47744772
for (; l < minwid && p + 1 < out + outlen; l++)
4775-
*p++ = fillchar;
4773+
MB_CHAR2BYTES(fillchar, p);
47764774
}
47774775
else if (num >= 0)
47784776
{
@@ -4875,7 +4873,7 @@ build_stl_str_hl(
48754873
}
48764874
// Fill up for half a double-wide character.
48774875
while (++width < maxwidth)
4878-
*s++ = fillchar;
4876+
MB_CHAR2BYTES(fillchar, s);
48794877
}
48804878
else
48814879
s = out + maxwidth - 1;
@@ -4907,7 +4905,7 @@ build_stl_str_hl(
49074905
while (++width < maxwidth)
49084906
{
49094907
s = s + STRLEN(s);
4910-
*s++ = fillchar;
4908+
MB_CHAR2BYTES(fillchar, s);
49114909
*s = NUL;
49124910
}
49134911

@@ -4930,12 +4928,13 @@ build_stl_str_hl(
49304928
break;
49314929
if (l < itemcnt)
49324930
{
4933-
p = stl_items[l].stl_start + maxwidth - width;
4931+
int middlelength = (maxwidth - width) * MB_CHAR2LEN(fillchar);
4932+
p = stl_items[l].stl_start + middlelength;
49344933
STRMOVE(p, stl_items[l].stl_start);
4935-
for (s = stl_items[l].stl_start; s < p; s++)
4936-
*s = fillchar;
4934+
for (s = stl_items[l].stl_start; s < p;)
4935+
MB_CHAR2BYTES(fillchar, s);
49374936
for (l++; l < itemcnt; l++)
4938-
stl_items[l].stl_start += maxwidth - width;
4937+
stl_items[l].stl_start += middlelength;
49394938
width = maxwidth;
49404939
}
49414940
}

src/eval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3130,7 +3130,7 @@ eval6(
31303130
*/
31313131
if (evaluate && in_vim9script() && !IS_WHITE_OR_NUL((*arg)[1]))
31323132
{
3133-
error_white_both(p, 1);
3133+
error_white_both(*arg, 1);
31343134
clear_tv(rettv);
31353135
return FAIL;
31363136
}

src/evalvars.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ ex_let(exarg_T *eap)
911911
}
912912

913913
/*
914-
* Assign the typevalue "tv" to the variable or variables at "arg_start".
914+
* Assign the typeval "tv" to the variable or variables at "arg_start".
915915
* Handles both "var" with any type and "[var, var; var]" with a list type.
916916
* When "op" is not NULL it points to a string with characters that
917917
* must appear after the variable(s). Use "+", "-" or "." for add, subtract
@@ -3181,6 +3181,7 @@ set_var_const(
31813181

31823182
if (di != NULL)
31833183
{
3184+
// Item already exists. Allowed to replace when reloading.
31843185
if ((di->di_flags & DI_FLAGS_RELOAD) == 0)
31853186
{
31863187
if (flags & (ASSIGN_CONST | ASSIGN_FINAL))
@@ -3271,6 +3272,14 @@ set_var_const(
32713272
}
32723273
else
32733274
{
3275+
// Item not found, check if a function already exists.
3276+
if (is_script_local && (flags & (ASSIGN_NO_DECL | ASSIGN_DECL)) == 0
3277+
&& lookup_scriptitem(name, STRLEN(name), NULL) == OK)
3278+
{
3279+
semsg(_(e_redefining_script_item_str), name);
3280+
goto failed;
3281+
}
3282+
32743283
// add a new variable
32753284
if (vim9script && is_script_local && (flags & ASSIGN_NO_DECL))
32763285
{

src/macros.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@
252252
#define MB_CHARLEN(p) (has_mbyte ? mb_charlen(p) : (int)STRLEN(p))
253253
#define MB_CHAR2LEN(c) (has_mbyte ? mb_char2len(c) : 1)
254254
#define PTR2CHAR(p) (has_mbyte ? mb_ptr2char(p) : (int)*(p))
255+
#define MB_CHAR2BYTES(c, b) do { if (has_mbyte) (b) += (*mb_char2bytes)((c), (b)); else *(b)++ = (c); } while(0)
255256

256257
#ifdef FEAT_AUTOCHDIR
257258
# define DO_AUTOCHDIR do { if (p_acd) do_autochdir(); } while (0)

src/screen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ fill_foldcolumn(
266266
empty = (fdc == 1) ? 0 : 1;
267267

268268
// If the column is too narrow, we start at the lowest level that
269-
// fits and use numbers to indicated the depth.
269+
// fits and use numbers to indicate the depth.
270270
first_level = level - fdc - closed + 1 + empty;
271271
if (first_level < 1)
272272
first_level = 1;

src/tag.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3510,6 +3510,11 @@ jumpto_tag(
35103510
// Save value of no_hlsearch, jumping to a tag is not a real search
35113511
save_no_hlsearch = no_hlsearch;
35123512
#endif
3513+
#ifdef FEAT_PROP_POPUP
3514+
// getfile() may have cleared options, apply 'previewpopup' again.
3515+
if (g_do_tagpreview != 0 && *p_pvp != NUL)
3516+
parse_previewpopup(curwin);
3517+
#endif
35133518

35143519
/*
35153520
* If 'cpoptions' contains 't', store the search pattern for the "n"

src/testdir/dumps/Test_popupwin_previewpopup_2.dump

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
|o+0&#ffffff0|n|e| @71
22
|#|i|n|c|l|u|d|e| |"|X|h|e|a|d|e|r|.|h|"| @54
33
|t|h|r|e@1| @69
4-
|f|o|u|r| @3|╔+0#0000001#ffd7ff255| |X|t|a|g|f|i|l|e| |═@30|X| +0#0000000#ffffff0@23
5-
|f|i|v|e| @3|║+0#0000001#ffd7ff255|2|7| @37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@23
6-
|s|i|x| @4|║+0#0000001#ffd7ff255|t|h|i|s| |i|s| |a|n|o|t|h|e|r| |p|l|a|c|e| @18| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@23
7-
|s|e|v|e|n| @2|║+0#0000001#ffd7ff255|2|9| @37| +0#0000000#0000001|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@23
8-
|f|i|n|d| |t|h|e|║+0#0000001#ffd7ff255|3|0| @37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@23
9-
|n|i|n|e| @3|╚+0#0000001#ffd7ff255|═@40|⇲| +0#0000000#ffffff0@23
4+
|f|o|u|r| @3|╔+0&#afffff255| |X|t|a|g|f|i|l|e| |═@30|X| +0&#ffffff0@23
5+
|f|i|v|e| @3|║+0&#afffff255|2|7| @37| +0&#a8a8a8255|║+0&#afffff255| +0&#ffffff0@23
6+
|s|i|x| @4|║+0&#afffff255|t|h|i|s| |i|s| |a|n|o|t|h|e|r| |p|l|a|c|e| @18| +0&#a8a8a8255|║+0&#afffff255| +0&#ffffff0@23
7+
|s|e|v|e|n| @2|║+0&#afffff255|2|9| @37| +0&#0000001|║+0&#afffff255| +0&#ffffff0@23
8+
|f|i|n|d| |t|h|e|║+0&#afffff255|3|0| @37| +0&#a8a8a8255|║+0&#afffff255| +0&#ffffff0@23
9+
|n|i|n|e| @3|╚+0&#afffff255|═@40|⇲| +0&#ffffff0@23
1010
|t|h|i|s| |i|s| >a|n|o|t|h|e|r| |w|o|r|d| @54
1111
|v|e|r|y| |l|o|n|g| |l|i|n|e| |w|h|e|r|e| |t|h|e| |w|o|r|d| |i|s| |a|l|s|o| |a|n|o|t|h|e|r| @29
1212
|~+0#4040ff13&| @73

src/testdir/dumps/Test_popupwin_previewpopup_3.dump

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
|o+0&#ffffff0|n|e| @71
22
|#|i|n|c|l|u|d|e| |"|X|h|e|a|d|e|r|.|h|"| @54
33
|t|h|r|e@1| @69
4-
|f|o|u|r| @9|╔+0#0000001#ffd7ff255| |X|t|a|g|f|i|l|e| |═@30|X| +0#0000000#ffffff0@17
5-
|f|i|v|e| @9|║+0#0000001#ffd7ff255|2|7| @37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@17
6-
|s|i|x| @10|║+0#0000001#ffd7ff255|t|h|i|s| |i|s| |a|n|o|t|h|e|r| |p|l|a|c|e| @18| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@17
7-
|s|e|v|e|n| @8|║+0#0000001#ffd7ff255|2|9| @37| +0#0000000#0000001|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@17
8-
|f|i|n|d| |t|h|e|w|o|r|d| |s|║+0#0000001#ffd7ff255|3|0| @37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@17
9-
|n|i|n|e| @9|╚+0#0000001#ffd7ff255|═@40|⇲| +0#0000000#ffffff0@17
4+
|f|o|u|r| @9|╔+0&#afffff255| |X|t|a|g|f|i|l|e| |═@30|X| +0&#ffffff0@17
5+
|f|i|v|e| @9|║+0&#afffff255|2|7| @37| +0&#a8a8a8255|║+0&#afffff255| +0&#ffffff0@17
6+
|s|i|x| @10|║+0&#afffff255|t|h|i|s| |i|s| |a|n|o|t|h|e|r| |p|l|a|c|e| @18| +0&#a8a8a8255|║+0&#afffff255| +0&#ffffff0@17
7+
|s|e|v|e|n| @8|║+0&#afffff255|2|9| @37| +0&#0000001|║+0&#afffff255| +0&#ffffff0@17
8+
|f|i|n|d| |t|h|e|w|o|r|d| |s|║+0&#afffff255|3|0| @37| +0&#a8a8a8255|║+0&#afffff255| +0&#ffffff0@17
9+
|n|i|n|e| @9|╚+0&#afffff255|═@40|⇲| +0&#ffffff0@17
1010
|t|h|i|s| |i|s| >a|n|o|t|h|e|r| |w|o|r|d| @54
1111
|v|e|r|y| |l|o|n|g| |l|i|n|e| |w|h|e|r|e| |t|h|e| |w|o|r|d| |i|s| |a|l|s|o| |a|n|o|t|h|e|r| @29
1212
|~+0#4040ff13&| @73

src/testdir/dumps/Test_popupwin_previewpopup_4.dump

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
|#|i|n|c|l|u|d|e| |"|X|h|e|a|d|e|r|.|h|"| @54
33
|t|h|r|e@1| @69
44
|f|o|u|r| @70
5-
|f|i|v|e| @28|╔+0#0000001#ffd7ff255| |X|t|a|g|f|i|l|e| |═@29|X
6-
|s+0#0000000#ffffff0|i|x| @29|║+0#0000001#ffd7ff255|2|7| @36| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255
7-
|s+0#0000000#ffffff0|e|v|e|n| @27|║+0#0000001#ffd7ff255|t|h|i|s| |i|s| |a|n|o|t|h|e|r| |p|l|a|c|e| @17| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255
8-
|f+0#0000000#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @10|║+0#0000001#ffd7ff255|2|9| @36| +0#0000000#0000001|║+0#0000001#ffd7ff255
9-
|n+0#0000000#ffffff0|i|n|e| @28|║+0#0000001#ffd7ff255|3|0| @36| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255
10-
|t+0#0000000#ffffff0|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @12|╚+0#0000001#ffd7ff255|═@39|⇲
11-
|v+0#0000000#ffffff0|e|r|y| |l|o|n|g| |l|i|n|e| |w|h|e|r|e| |t|h|e| |w|o|r|d| |i|s| |a|l|s|o| >a|n|o|t|h|e|r| @29
5+
|f|i|v|e| @28|╔+0&#afffff255| |X|t|a|g|f|i|l|e| |═@29|X
6+
|s+0&#ffffff0|i|x| @29|║+0&#afffff255|2|7| @36| +0&#a8a8a8255|║+0&#afffff255
7+
|s+0&#ffffff0|e|v|e|n| @27|║+0&#afffff255|t|h|i|s| |i|s| |a|n|o|t|h|e|r| |p|l|a|c|e| @17| +0&#a8a8a8255|║+0&#afffff255
8+
|f+0&#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @10|║+0&#afffff255|2|9| @36| +0&#0000001|║+0&#afffff255
9+
|n+0&#ffffff0|i|n|e| @28|║+0&#afffff255|3|0| @36| +0&#a8a8a8255|║+0&#afffff255
10+
|t+0&#ffffff0|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @12|╚+0&#afffff255|═@39|⇲
11+
|v+0&#ffffff0|e|r|y| |l|o|n|g| |l|i|n|e| |w|h|e|r|e| |t|h|e| |w|o|r|d| |i|s| |a|l|s|o| >a|n|o|t|h|e|r| @29
1212
|~+0#4040ff13&| @73
1313
|~| @73
1414
|/+0#0000000&|a|n|o|t|h|e|r| @48|1@1|,|3|9| @8|A|l@1|

0 commit comments

Comments
 (0)