summaryrefslogtreecommitdiff
path: root/src/mbyte.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-08-22 22:12:17 +0200
committerBram Moolenaar <Bram@vim.org>2017-08-22 22:12:17 +0200
commit6d0826dfbba9880820d9ec221327e4250bbf6540 (patch)
tree4cc32379c4c21b3dfced4bc8339d8541188cf18f /src/mbyte.c
parent5830232c021102e47a4e6fc81857604e4a031ddf (diff)
downloadvim-git-6d0826dfbba9880820d9ec221327e4250bbf6540.tar.gz
patch 8.0.0985: libvterm has its own idea of character widthv8.0.0985
Problem: Libvterm has its own idea of character width. Solution: Use the Vim functions for character width and composing to avoid a mismatch. (idea by Yasuhiro Matsumoto)
Diffstat (limited to 'src/mbyte.c')
-rw-r--r--src/mbyte.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mbyte.c b/src/mbyte.c
index 33fa0a254..e3c47d6a5 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -1395,6 +1395,17 @@ static struct interval ambiguous[] =
{0x100000, 0x10fffd}
};
+#if defined(FEAT_TERMINAL) || defined(PROTO)
+/*
+ * utf_char2cells() with different argument type for libvterm.
+ */
+ int
+utf_uint2cells(uint32_t c)
+{
+ return utf_char2cells((int)c);
+}
+#endif
+
/*
* For UTF-8 character "c" return 2 for a double-width character, 1 for others.
* Returns 4 or 6 for an unprintable character.
@@ -2296,6 +2307,17 @@ utf_char2bytes(int c, char_u *buf)
return 6;
}
+#if defined(FEAT_TERMINAL) || defined(PROTO)
+/*
+ * utf_iscomposing() with different argument type for libvterm.
+ */
+ int
+utf_iscomposing_uint(uint32_t c)
+{
+ return utf_iscomposing((int)c);
+}
+#endif
+
/*
* Return TRUE if "c" is a composing UTF-8 character. This means it will be
* drawn on top of the preceding character.