fix(statusline): fill for double-width char after moving items (#24207)

This commit is contained in:
zeertzjq
2023-06-30 08:36:09 +08:00
committed by GitHub
parent 8758c6fb87
commit d7bb19e013
2 changed files with 73 additions and 23 deletions

View File

@@ -263,6 +263,7 @@ void stl_fill_click_defs(StlClickDefinition *click_defs, StlClickRecord *click_r
};
for (int i = 0; click_recs[i].start != NULL; i++) {
len += vim_strnsize(buf, (int)(click_recs[i].start - buf));
assert(len <= width);
if (col < len) {
while (col < len) {
click_defs[col++] = cur_click_def;
@@ -2052,17 +2053,6 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
// Put a `<` to mark where we truncated at
*trunc_p = '<';
if (width + 1 < maxwidth) {
// Advance the pointer to the end of the string
trunc_p = trunc_p + strlen(trunc_p);
}
// Fill up for half a double-wide character.
while (++width < maxwidth) {
MB_CHAR2BYTES(fillchar, trunc_p);
*trunc_p = NUL;
}
// }
// { Change the start point for items based on
@@ -2084,6 +2074,17 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
}
}
// }
if (width + 1 < maxwidth) {
// Advance the pointer to the end of the string
trunc_p = trunc_p + strlen(trunc_p);
}
// Fill up for half a double-wide character.
while (++width < maxwidth) {
MB_CHAR2BYTES(fillchar, trunc_p);
*trunc_p = NUL;
}
}
width = maxwidth;