vim-patch:9.1.0666: assert_equal() doesn't show multibyte string correctly (#30018)

Problem:  assert_equal() doesn't show multibyte string correctly
Solution: Properly advance over a multibyte char.
          (zeertzjq)

closes: vim/vim#15456

9c4b2462bb
This commit is contained in:
zeertzjq
2024-08-10 06:35:51 +08:00
committed by GitHub
parent 0d3f2c4904
commit 4e8efe002e
2 changed files with 12 additions and 2 deletions

View File

@@ -130,7 +130,7 @@ static void ga_concat_shorten_esc(garray_T *gap, const char *str)
return;
}
for (const char *p = str; *p != NUL; p++) {
for (const char *p = str; *p != NUL;) {
int same_len = 1;
const char *s = p;
const int c = mb_cptr2char_adv(&s);
@@ -146,9 +146,10 @@ static void ga_concat_shorten_esc(garray_T *gap, const char *str)
vim_snprintf(buf, NUMBUFLEN, "%d", same_len);
ga_concat(gap, buf);
ga_concat(gap, " times]");
p = s - 1;
p = s;
} else {
ga_concat_esc(gap, p, clen);
p += clen;
}
}
}