aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2016-10-11 17:33:21 -0400
committerJames McCoy <jamessan@jamessan.com>2016-10-11 18:59:01 -0400
commit892f55bd20615031132b0ed13b1861be3b645ecc (patch)
tree3ff3edebce49077b01b8d196d66039bb9ca1196a /src
parent44084310862656788a39b53766b1d6fe18995242 (diff)
downloadrneovim-892f55bd20615031132b0ed13b1861be3b645ecc.tar.gz
rneovim-892f55bd20615031132b0ed13b1861be3b645ecc.tar.bz2
rneovim-892f55bd20615031132b0ed13b1861be3b645ecc.zip
ui: Fix the call to utf_ambiguous_width
`utf_ambiguous_width` expects the Unicode character, but in 9e1c6596 I just passed the first UTF-8 byte to the function. This led to various display problems because now many multi-cell characters weren't falling into that part of the branch. Also, to better align with the existing Vim code, remove the forced cursor update. Setting the flag will cause it to happen in the next UI_CALL. Thanks to qvacua for all the help investigating the issue! Closes #5448
Diffstat (limited to 'src')
-rw-r--r--src/nvim/mbyte.c2
-rw-r--r--src/nvim/ui.c3
2 files changed, 2 insertions, 3 deletions
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c
index c08b9e8fcf..e6312f9c00 100644
--- a/src/nvim/mbyte.c
+++ b/src/nvim/mbyte.c
@@ -1724,7 +1724,7 @@ int utf_class(int c)
return 2;
}
-int utf_ambiguous_width(int c)
+bool utf_ambiguous_width(int c)
{
return c >= 0x80 && (intable(ambiguous, ARRAY_SIZE(ambiguous), c)
|| intable(emoji_all, ARRAY_SIZE(emoji_all), c));
diff --git a/src/nvim/ui.c b/src/nvim/ui.c
index 648d633e07..cf5e95f88a 100644
--- a/src/nvim/ui.c
+++ b/src/nvim/ui.c
@@ -397,9 +397,8 @@ static void send_output(uint8_t **ptr)
size_t clen = (size_t)mb_ptr2len(p);
UI_CALL(put, p, (size_t)clen);
col++;
- if (utf_ambiguous_width(*p)) {
+ if (utf_ambiguous_width(utf_ptr2char(p))) {
pending_cursor_update = true;
- flush_cursor_update();
} else if (mb_ptr2cells(p) > 1) {
// double cell character, blank the next cell
UI_CALL(put, NULL, 0);