@@ -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 }
0 commit comments