comparison src/mbyte.c @ 12210:b9b06aa0b6d9 v8.0.0985

patch 8.0.0985: libvterm has its own idea of character width commit https://github.com/vim/vim/commit/6d0826dfbba9880820d9ec221327e4250bbf6540 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 22 22:12:17 2017 +0200 patch 8.0.0985: libvterm has its own idea of character width 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)
author Christian Brabandt <cb@256bit.org>
date Tue, 22 Aug 2017 22:15:04 +0200
parents f7ba69508fd5
children d2373927d76d
comparison
equal deleted inserted replaced
12209:71f25f291349 12210:b9b06aa0b6d9
1393 {0xe0100, 0xe01ef}, 1393 {0xe0100, 0xe01ef},
1394 {0xf0000, 0xffffd}, 1394 {0xf0000, 0xffffd},
1395 {0x100000, 0x10fffd} 1395 {0x100000, 0x10fffd}
1396 }; 1396 };
1397 1397
1398 #if defined(FEAT_TERMINAL) || defined(PROTO)
1399 /*
1400 * utf_char2cells() with different argument type for libvterm.
1401 */
1402 int
1403 utf_uint2cells(uint32_t c)
1404 {
1405 return utf_char2cells((int)c);
1406 }
1407 #endif
1408
1398 /* 1409 /*
1399 * For UTF-8 character "c" return 2 for a double-width character, 1 for others. 1410 * For UTF-8 character "c" return 2 for a double-width character, 1 for others.
1400 * Returns 4 or 6 for an unprintable character. 1411 * Returns 4 or 6 for an unprintable character.
1401 * Is only correct for characters >= 0x80. 1412 * Is only correct for characters >= 0x80.
1402 * When p_ambw is "double", return 2 for a character with East Asian Width 1413 * When p_ambw is "double", return 2 for a character with East Asian Width
2293 buf[3] = 0x80 + (((unsigned)c >> 12) & 0x3f); 2304 buf[3] = 0x80 + (((unsigned)c >> 12) & 0x3f);
2294 buf[4] = 0x80 + (((unsigned)c >> 6) & 0x3f); 2305 buf[4] = 0x80 + (((unsigned)c >> 6) & 0x3f);
2295 buf[5] = 0x80 + (c & 0x3f); 2306 buf[5] = 0x80 + (c & 0x3f);
2296 return 6; 2307 return 6;
2297 } 2308 }
2309
2310 #if defined(FEAT_TERMINAL) || defined(PROTO)
2311 /*
2312 * utf_iscomposing() with different argument type for libvterm.
2313 */
2314 int
2315 utf_iscomposing_uint(uint32_t c)
2316 {
2317 return utf_iscomposing((int)c);
2318 }
2319 #endif
2298 2320
2299 /* 2321 /*
2300 * Return TRUE if "c" is a composing UTF-8 character. This means it will be 2322 * Return TRUE if "c" is a composing UTF-8 character. This means it will be
2301 * drawn on top of the preceding character. 2323 * drawn on top of the preceding character.
2302 * Based on code from Markus Kuhn. 2324 * Based on code from Markus Kuhn.