@@ -4157,9 +4157,6 @@ build_stl_str_hl(
41574157
41584158 if (fillchar == 0 )
41594159 fillchar = ' ' ;
4160- // Can't handle a multi-byte fill character yet.
4161- else if (mb_char2len (fillchar ) > 1 )
4162- fillchar = '-' ;
41634160
41644161 // The cursor in windows other than the current one isn't always
41654162 // up-to-date, esp. because of autocommands and timers.
@@ -4335,7 +4332,7 @@ build_stl_str_hl(
43354332
43364333 // Fill up space left over by half a double-wide char.
43374334 while (++ l < stl_items [stl_groupitem [groupdepth ]].stl_minwid )
4338- * p ++ = fillchar ;
4335+ MB_CHAR2BYTES ( fillchar , p ) ;
43394336
43404337 // correct the start of the items for the truncation
43414338 for (l = stl_groupitem [groupdepth ] + 1 ; l < curitem ; l ++ )
@@ -4354,20 +4351,20 @@ build_stl_str_hl(
43544351 // fill by appending characters
43554352 n = 0 - n ;
43564353 while (l ++ < n && p + 1 < out + outlen )
4357- * p ++ = fillchar ;
4354+ MB_CHAR2BYTES ( fillchar , p ) ;
43584355 }
43594356 else
43604357 {
43614358 // fill by inserting characters
4362- mch_memmove ( t + n - l , t , ( size_t )( p - t ) );
4363- l = n - l ;
4359+ l = ( n - l ) * MB_CHAR2LEN ( fillchar );
4360+ mch_memmove ( t + l , t , ( size_t )( p - t )) ;
43644361 if (p + l >= out + outlen )
43654362 l = (long )((out + outlen ) - p - 1 );
43664363 p += l ;
43674364 for (n = stl_groupitem [groupdepth ] + 1 ; n < curitem ; n ++ )
43684365 stl_items [n ].stl_start += l ;
43694366 for ( ; l > 0 ; l -- )
4370- * t ++ = fillchar ;
4367+ MB_CHAR2BYTES ( fillchar , t ) ;
43714368 }
43724369 }
43734370 continue ;
@@ -4746,23 +4743,24 @@ build_stl_str_hl(
47464743 if (l + 1 == minwid && fillchar == '-' && VIM_ISDIGIT (* t ))
47474744 * p ++ = ' ' ;
47484745 else
4749- * p ++ = fillchar ;
4746+ MB_CHAR2BYTES ( fillchar , p ) ;
47504747 }
47514748 minwid = 0 ;
47524749 }
47534750 else
47544751 minwid *= -1 ;
4755- while ( * t && p + 1 < out + outlen )
4752+ for (; * t && p + 1 < out + outlen ; t ++ )
47564753 {
4757- * p ++ = * t ++ ;
47584754 // Change a space by fillchar, unless fillchar is '-' and a
47594755 // digit follows.
4760- if (fillable && p [-1 ] == ' '
4761- && (!VIM_ISDIGIT (* t ) || fillchar != '-' ))
4762- p [-1 ] = fillchar ;
4756+ if (fillable && * t == ' '
4757+ && (!VIM_ISDIGIT (* (t + 1 )) || fillchar != '-' ))
4758+ MB_CHAR2BYTES (fillchar , p );
4759+ else
4760+ * p ++ = * t ;
47634761 }
47644762 for (; l < minwid && p + 1 < out + outlen ; l ++ )
4765- * p ++ = fillchar ;
4763+ MB_CHAR2BYTES ( fillchar , p ) ;
47664764 }
47674765 else if (num >= 0 )
47684766 {
@@ -4865,7 +4863,7 @@ build_stl_str_hl(
48654863 }
48664864 // Fill up for half a double-wide character.
48674865 while (++ width < maxwidth )
4868- * s ++ = fillchar ;
4866+ MB_CHAR2BYTES ( fillchar , s ) ;
48694867 }
48704868 else
48714869 s = out + maxwidth - 1 ;
@@ -4897,7 +4895,7 @@ build_stl_str_hl(
48974895 while (++ width < maxwidth )
48984896 {
48994897 s = s + STRLEN (s );
4900- * s ++ = fillchar ;
4898+ MB_CHAR2BYTES ( fillchar , s ) ;
49014899 * s = NUL ;
49024900 }
49034901
@@ -4920,12 +4918,13 @@ build_stl_str_hl(
49204918 break ;
49214919 if (l < itemcnt )
49224920 {
4923- p = stl_items [l ].stl_start + maxwidth - width ;
4921+ int middlelength = (maxwidth - width ) * MB_CHAR2LEN (fillchar );
4922+ p = stl_items [l ].stl_start + middlelength ;
49244923 STRMOVE (p , stl_items [l ].stl_start );
4925- for (s = stl_items [l ].stl_start ; s < p ; s ++ )
4926- * s = fillchar ;
4924+ for (s = stl_items [l ].stl_start ; s < p ;)
4925+ MB_CHAR2BYTES ( fillchar , s ) ;
49274926 for (l ++ ; l < itemcnt ; l ++ )
4928- stl_items [l ].stl_start += maxwidth - width ;
4927+ stl_items [l ].stl_start += middlelength ;
49294928 width = maxwidth ;
49304929 }
49314930 }
0 commit comments