[vim] 09/139: patch 7.4.1697 Problem: Display problems when the 'ambiwidth' and 'emoji' options are not set properly or the terminal doesn't behave as expected. Solution: After drawing an ambiguous width character always position the cursor.

James McCoy jamessan at debian.org
Fri May 6 03:59:55 UTC 2016


This is an automated email from the git hooks/post-receive script.

jamessan pushed a commit to branch debian/sid
in repository vim.

commit cb0700844c1274fe8bc0ceaffaee0ad21c406f30
Author: Bram Moolenaar <Bram at vim.org>
Date:   Sat Apr 2 22:14:51 2016 +0200

    patch 7.4.1697
    Problem:    Display problems when the 'ambiwidth' and 'emoji' options are not
                set properly or the terminal doesn't behave as expected.
    Solution:   After drawing an ambiguous width character always position the
                cursor.
---
 src/mbyte.c         | 597 ++++++++++++++++++++++++++--------------------------
 src/proto/mbyte.pro |   1 +
 src/screen.c        |   4 +-
 src/version.c       |   2 +
 4 files changed, 308 insertions(+), 296 deletions(-)

diff --git a/src/mbyte.c b/src/mbyte.c
index f38e63e..6d419b2 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -1210,6 +1210,185 @@ intable(struct interval *table, size_t size, int c)
     return FALSE;
 }
 
+/* Sorted list of non-overlapping intervals of East Asian Ambiguous
+ * characters, generated with ../runtime/tools/unicode.vim. */
+static struct interval ambiguous[] =
+{
+    {0x00a1, 0x00a1},
+    {0x00a4, 0x00a4},
+    {0x00a7, 0x00a8},
+    {0x00aa, 0x00aa},
+    {0x00ad, 0x00ae},
+    {0x00b0, 0x00b4},
+    {0x00b6, 0x00ba},
+    {0x00bc, 0x00bf},
+    {0x00c6, 0x00c6},
+    {0x00d0, 0x00d0},
+    {0x00d7, 0x00d8},
+    {0x00de, 0x00e1},
+    {0x00e6, 0x00e6},
+    {0x00e8, 0x00ea},
+    {0x00ec, 0x00ed},
+    {0x00f0, 0x00f0},
+    {0x00f2, 0x00f3},
+    {0x00f7, 0x00fa},
+    {0x00fc, 0x00fc},
+    {0x00fe, 0x00fe},
+    {0x0101, 0x0101},
+    {0x0111, 0x0111},
+    {0x0113, 0x0113},
+    {0x011b, 0x011b},
+    {0x0126, 0x0127},
+    {0x012b, 0x012b},
+    {0x0131, 0x0133},
+    {0x0138, 0x0138},
+    {0x013f, 0x0142},
+    {0x0144, 0x0144},
+    {0x0148, 0x014b},
+    {0x014d, 0x014d},
+    {0x0152, 0x0153},
+    {0x0166, 0x0167},
+    {0x016b, 0x016b},
+    {0x01ce, 0x01ce},
+    {0x01d0, 0x01d0},
+    {0x01d2, 0x01d2},
+    {0x01d4, 0x01d4},
+    {0x01d6, 0x01d6},
+    {0x01d8, 0x01d8},
+    {0x01da, 0x01da},
+    {0x01dc, 0x01dc},
+    {0x0251, 0x0251},
+    {0x0261, 0x0261},
+    {0x02c4, 0x02c4},
+    {0x02c7, 0x02c7},
+    {0x02c9, 0x02cb},
+    {0x02cd, 0x02cd},
+    {0x02d0, 0x02d0},
+    {0x02d8, 0x02db},
+    {0x02dd, 0x02dd},
+    {0x02df, 0x02df},
+    {0x0300, 0x036f},
+    {0x0391, 0x03a1},
+    {0x03a3, 0x03a9},
+    {0x03b1, 0x03c1},
+    {0x03c3, 0x03c9},
+    {0x0401, 0x0401},
+    {0x0410, 0x044f},
+    {0x0451, 0x0451},
+    {0x2010, 0x2010},
+    {0x2013, 0x2016},
+    {0x2018, 0x2019},
+    {0x201c, 0x201d},
+    {0x2020, 0x2022},
+    {0x2024, 0x2027},
+    {0x2030, 0x2030},
+    {0x2032, 0x2033},
+    {0x2035, 0x2035},
+    {0x203b, 0x203b},
+    {0x203e, 0x203e},
+    {0x2074, 0x2074},
+    {0x207f, 0x207f},
+    {0x2081, 0x2084},
+    {0x20ac, 0x20ac},
+    {0x2103, 0x2103},
+    {0x2105, 0x2105},
+    {0x2109, 0x2109},
+    {0x2113, 0x2113},
+    {0x2116, 0x2116},
+    {0x2121, 0x2122},
+    {0x2126, 0x2126},
+    {0x212b, 0x212b},
+    {0x2153, 0x2154},
+    {0x215b, 0x215e},
+    {0x2160, 0x216b},
+    {0x2170, 0x2179},
+    {0x2189, 0x2189},
+    {0x2190, 0x2199},
+    {0x21b8, 0x21b9},
+    {0x21d2, 0x21d2},
+    {0x21d4, 0x21d4},
+    {0x21e7, 0x21e7},
+    {0x2200, 0x2200},
+    {0x2202, 0x2203},
+    {0x2207, 0x2208},
+    {0x220b, 0x220b},
+    {0x220f, 0x220f},
+    {0x2211, 0x2211},
+    {0x2215, 0x2215},
+    {0x221a, 0x221a},
+    {0x221d, 0x2220},
+    {0x2223, 0x2223},
+    {0x2225, 0x2225},
+    {0x2227, 0x222c},
+    {0x222e, 0x222e},
+    {0x2234, 0x2237},
+    {0x223c, 0x223d},
+    {0x2248, 0x2248},
+    {0x224c, 0x224c},
+    {0x2252, 0x2252},
+    {0x2260, 0x2261},
+    {0x2264, 0x2267},
+    {0x226a, 0x226b},
+    {0x226e, 0x226f},
+    {0x2282, 0x2283},
+    {0x2286, 0x2287},
+    {0x2295, 0x2295},
+    {0x2299, 0x2299},
+    {0x22a5, 0x22a5},
+    {0x22bf, 0x22bf},
+    {0x2312, 0x2312},
+    {0x2460, 0x24e9},
+    {0x24eb, 0x254b},
+    {0x2550, 0x2573},
+    {0x2580, 0x258f},
+    {0x2592, 0x2595},
+    {0x25a0, 0x25a1},
+    {0x25a3, 0x25a9},
+    {0x25b2, 0x25b3},
+    {0x25b6, 0x25b7},
+    {0x25bc, 0x25bd},
+    {0x25c0, 0x25c1},
+    {0x25c6, 0x25c8},
+    {0x25cb, 0x25cb},
+    {0x25ce, 0x25d1},
+    {0x25e2, 0x25e5},
+    {0x25ef, 0x25ef},
+    {0x2605, 0x2606},
+    {0x2609, 0x2609},
+    {0x260e, 0x260f},
+    {0x2614, 0x2615},
+    {0x261c, 0x261c},
+    {0x261e, 0x261e},
+    {0x2640, 0x2640},
+    {0x2642, 0x2642},
+    {0x2660, 0x2661},
+    {0x2663, 0x2665},
+    {0x2667, 0x266a},
+    {0x266c, 0x266d},
+    {0x266f, 0x266f},
+    {0x269e, 0x269f},
+    {0x26be, 0x26bf},
+    {0x26c4, 0x26cd},
+    {0x26cf, 0x26e1},
+    {0x26e3, 0x26e3},
+    {0x26e8, 0x26ff},
+    {0x273d, 0x273d},
+    {0x2757, 0x2757},
+    {0x2776, 0x277f},
+    {0x2b55, 0x2b59},
+    {0x3248, 0x324f},
+    {0xe000, 0xf8ff},
+    {0xfe00, 0xfe0f},
+    {0xfffd, 0xfffd},
+    {0x1f100, 0x1f10a},
+    {0x1f110, 0x1f12d},
+    {0x1f130, 0x1f169},
+    {0x1f170, 0x1f19a},
+    {0xe0100, 0xe01ef},
+    {0xf0000, 0xffffd},
+    {0x100000, 0x10fffd}
+};
+
 /*
  * For UTF-8 character "c" return 2 for a double-width character, 1 for others.
  * Returns 4 or 6 for an unprintable character.
@@ -1261,185 +1440,6 @@ utf_char2cells(int c)
 	{0x30000, 0x3fffd}
     };
 
-    /* Sorted list of non-overlapping intervals of East Asian Ambiguous
-     * characters, generated with ../runtime/tools/unicode.vim. */
-    static struct interval ambiguous[] =
-    {
-	{0x00a1, 0x00a1},
-	{0x00a4, 0x00a4},
-	{0x00a7, 0x00a8},
-	{0x00aa, 0x00aa},
-	{0x00ad, 0x00ae},
-	{0x00b0, 0x00b4},
-	{0x00b6, 0x00ba},
-	{0x00bc, 0x00bf},
-	{0x00c6, 0x00c6},
-	{0x00d0, 0x00d0},
-	{0x00d7, 0x00d8},
-	{0x00de, 0x00e1},
-	{0x00e6, 0x00e6},
-	{0x00e8, 0x00ea},
-	{0x00ec, 0x00ed},
-	{0x00f0, 0x00f0},
-	{0x00f2, 0x00f3},
-	{0x00f7, 0x00fa},
-	{0x00fc, 0x00fc},
-	{0x00fe, 0x00fe},
-	{0x0101, 0x0101},
-	{0x0111, 0x0111},
-	{0x0113, 0x0113},
-	{0x011b, 0x011b},
-	{0x0126, 0x0127},
-	{0x012b, 0x012b},
-	{0x0131, 0x0133},
-	{0x0138, 0x0138},
-	{0x013f, 0x0142},
-	{0x0144, 0x0144},
-	{0x0148, 0x014b},
-	{0x014d, 0x014d},
-	{0x0152, 0x0153},
-	{0x0166, 0x0167},
-	{0x016b, 0x016b},
-	{0x01ce, 0x01ce},
-	{0x01d0, 0x01d0},
-	{0x01d2, 0x01d2},
-	{0x01d4, 0x01d4},
-	{0x01d6, 0x01d6},
-	{0x01d8, 0x01d8},
-	{0x01da, 0x01da},
-	{0x01dc, 0x01dc},
-	{0x0251, 0x0251},
-	{0x0261, 0x0261},
-	{0x02c4, 0x02c4},
-	{0x02c7, 0x02c7},
-	{0x02c9, 0x02cb},
-	{0x02cd, 0x02cd},
-	{0x02d0, 0x02d0},
-	{0x02d8, 0x02db},
-	{0x02dd, 0x02dd},
-	{0x02df, 0x02df},
-	{0x0300, 0x036f},
-	{0x0391, 0x03a1},
-	{0x03a3, 0x03a9},
-	{0x03b1, 0x03c1},
-	{0x03c3, 0x03c9},
-	{0x0401, 0x0401},
-	{0x0410, 0x044f},
-	{0x0451, 0x0451},
-	{0x2010, 0x2010},
-	{0x2013, 0x2016},
-	{0x2018, 0x2019},
-	{0x201c, 0x201d},
-	{0x2020, 0x2022},
-	{0x2024, 0x2027},
-	{0x2030, 0x2030},
-	{0x2032, 0x2033},
-	{0x2035, 0x2035},
-	{0x203b, 0x203b},
-	{0x203e, 0x203e},
-	{0x2074, 0x2074},
-	{0x207f, 0x207f},
-	{0x2081, 0x2084},
-	{0x20ac, 0x20ac},
-	{0x2103, 0x2103},
-	{0x2105, 0x2105},
-	{0x2109, 0x2109},
-	{0x2113, 0x2113},
-	{0x2116, 0x2116},
-	{0x2121, 0x2122},
-	{0x2126, 0x2126},
-	{0x212b, 0x212b},
-	{0x2153, 0x2154},
-	{0x215b, 0x215e},
-	{0x2160, 0x216b},
-	{0x2170, 0x2179},
-	{0x2189, 0x2189},
-	{0x2190, 0x2199},
-	{0x21b8, 0x21b9},
-	{0x21d2, 0x21d2},
-	{0x21d4, 0x21d4},
-	{0x21e7, 0x21e7},
-	{0x2200, 0x2200},
-	{0x2202, 0x2203},
-	{0x2207, 0x2208},
-	{0x220b, 0x220b},
-	{0x220f, 0x220f},
-	{0x2211, 0x2211},
-	{0x2215, 0x2215},
-	{0x221a, 0x221a},
-	{0x221d, 0x2220},
-	{0x2223, 0x2223},
-	{0x2225, 0x2225},
-	{0x2227, 0x222c},
-	{0x222e, 0x222e},
-	{0x2234, 0x2237},
-	{0x223c, 0x223d},
-	{0x2248, 0x2248},
-	{0x224c, 0x224c},
-	{0x2252, 0x2252},
-	{0x2260, 0x2261},
-	{0x2264, 0x2267},
-	{0x226a, 0x226b},
-	{0x226e, 0x226f},
-	{0x2282, 0x2283},
-	{0x2286, 0x2287},
-	{0x2295, 0x2295},
-	{0x2299, 0x2299},
-	{0x22a5, 0x22a5},
-	{0x22bf, 0x22bf},
-	{0x2312, 0x2312},
-	{0x2460, 0x24e9},
-	{0x24eb, 0x254b},
-	{0x2550, 0x2573},
-	{0x2580, 0x258f},
-	{0x2592, 0x2595},
-	{0x25a0, 0x25a1},
-	{0x25a3, 0x25a9},
-	{0x25b2, 0x25b3},
-	{0x25b6, 0x25b7},
-	{0x25bc, 0x25bd},
-	{0x25c0, 0x25c1},
-	{0x25c6, 0x25c8},
-	{0x25cb, 0x25cb},
-	{0x25ce, 0x25d1},
-	{0x25e2, 0x25e5},
-	{0x25ef, 0x25ef},
-	{0x2605, 0x2606},
-	{0x2609, 0x2609},
-	{0x260e, 0x260f},
-	{0x2614, 0x2615},
-	{0x261c, 0x261c},
-	{0x261e, 0x261e},
-	{0x2640, 0x2640},
-	{0x2642, 0x2642},
-	{0x2660, 0x2661},
-	{0x2663, 0x2665},
-	{0x2667, 0x266a},
-	{0x266c, 0x266d},
-	{0x266f, 0x266f},
-	{0x269e, 0x269f},
-	{0x26be, 0x26bf},
-	{0x26c4, 0x26cd},
-	{0x26cf, 0x26e1},
-	{0x26e3, 0x26e3},
-	{0x26e8, 0x26ff},
-	{0x273d, 0x273d},
-	{0x2757, 0x2757},
-	{0x2776, 0x277f},
-	{0x2b55, 0x2b59},
-	{0x3248, 0x324f},
-	{0xe000, 0xf8ff},
-	{0xfe00, 0xfe0f},
-	{0xfffd, 0xfffd},
-	{0x1f100, 0x1f10a},
-	{0x1f110, 0x1f12d},
-	{0x1f130, 0x1f169},
-	{0x1f170, 0x1f19a},
-	{0xe0100, 0xe01ef},
-	{0xf0000, 0xffffd},
-	{0x100000, 0x10fffd}
-    };
-
     /* Sorted list of non-overlapping intervals of Emoji characters that don't
      * have ambiguous or double width,
      * based on http://unicode.org/emoji/charts/emoji-list.html */
@@ -2478,6 +2478,122 @@ utf_printable(int c)
 #endif
 }
 
+/* Sorted list of non-overlapping intervals of all Emoji characters,
+ * based on http://unicode.org/emoji/charts/emoji-list.html */
+static struct interval emoji_all[] =
+{
+    {0x203c, 0x203c},
+    {0x2049, 0x2049},
+    {0x2122, 0x2122},
+    {0x2139, 0x2139},
+    {0x2194, 0x2199},
+    {0x21a9, 0x21aa},
+    {0x231a, 0x231b},
+    {0x2328, 0x2328},
+    {0x23cf, 0x23cf},
+    {0x23e9, 0x23f3},
+    {0x24c2, 0x24c2},
+    {0x25aa, 0x25ab},
+    {0x25b6, 0x25b6},
+    {0x25c0, 0x25c0},
+    {0x25fb, 0x25fe},
+    {0x2600, 0x2604},
+    {0x260e, 0x260e},
+    {0x2611, 0x2611},
+    {0x2614, 0x2615},
+    {0x2618, 0x2618},
+    {0x261d, 0x261d},
+    {0x2620, 0x2620},
+    {0x2622, 0x2623},
+    {0x2626, 0x2626},
+    {0x262a, 0x262a},
+    {0x262e, 0x262f},
+    {0x2638, 0x263a},
+    {0x2648, 0x2653},
+    {0x2660, 0x2660},
+    {0x2663, 0x2663},
+    {0x2665, 0x2666},
+    {0x2668, 0x2668},
+    {0x267b, 0x267b},
+    {0x267f, 0x267f},
+    {0x2692, 0x2694},
+    {0x2696, 0x2697},
+    {0x2699, 0x2699},
+    {0x269b, 0x269c},
+    {0x26a0, 0x26a1},
+    {0x26aa, 0x26ab},
+    {0x26b0, 0x26b1},
+    {0x26bd, 0x26be},
+    {0x26c4, 0x26c5},
+    {0x26c8, 0x26c8},
+    {0x26ce, 0x26cf},
+    {0x26d1, 0x26d1},
+    {0x26d3, 0x26d4},
+    {0x26e9, 0x26ea},
+    {0x26f0, 0x26f5},
+    {0x26f7, 0x26fa},
+    {0x26fd, 0x26fd},
+    {0x2702, 0x2702},
+    {0x2705, 0x2705},
+    {0x2708, 0x270d},
+    {0x270f, 0x270f},
+    {0x2712, 0x2712},
+    {0x2714, 0x2714},
+    {0x2716, 0x2716},
+    {0x271d, 0x271d},
+    {0x2721, 0x2721},
+    {0x2728, 0x2728},
+    {0x2733, 0x2734},
+    {0x2744, 0x2744},
+    {0x2747, 0x2747},
+    {0x274c, 0x274c},
+    {0x274e, 0x274e},
+    {0x2753, 0x2755},
+    {0x2757, 0x2757},
+    {0x2763, 0x2764},
+    {0x2795, 0x2797},
+    {0x27a1, 0x27a1},
+    {0x27b0, 0x27b0},
+    {0x27bf, 0x27bf},
+    {0x2934, 0x2935},
+    {0x2b05, 0x2b07},
+    {0x2b1b, 0x2b1c},
+    {0x2b50, 0x2b50},
+    {0x2b55, 0x2b55},
+    {0x3030, 0x3030},
+    {0x303d, 0x303d},
+    {0x3297, 0x3297},
+    {0x3299, 0x3299},
+    {0x1f004, 0x1f004},
+    {0x1f0cf, 0x1f0cf},
+    {0x1f170, 0x1f171},
+    {0x1f17e, 0x1f17f},
+    {0x1f18e, 0x1f18e},
+    {0x1f191, 0x1f19a},
+    {0x1f1e6, 0x1f1ff},
+    {0x1f201, 0x1f202},
+    {0x1f21a, 0x1f21a},
+    {0x1f22f, 0x1f22f},
+    {0x1f232, 0x1f23a},
+    {0x1f250, 0x1f251},
+    {0x1f300, 0x1f320},
+    {0x1f330, 0x1f335},
+    {0x1f337, 0x1f37c},
+    {0x1f380, 0x1f393},
+    {0x1f3a0, 0x1f3c4},
+    {0x1f3c6, 0x1f3ca},
+    {0x1f3e0, 0x1f3f0},
+    {0x1f400, 0x1f43e},
+    {0x1f440, 0x1f440},
+    {0x1f442, 0x1f4f7},
+    {0x1f4f9, 0x1f4fc},
+    {0x1f500, 0x1f53d},
+    {0x1f550, 0x1f567},
+    {0x1f5fb, 0x1f640},
+    {0x1f645, 0x1f64f},
+    {0x1f680, 0x1f6c5}
+};
+
 /*
  * Get class of a Unicode character.
  * 0: white space
@@ -2564,122 +2680,6 @@ utf_class(int c)
 	{0x2f800, 0x2fa1f, 0x4e00},	/* CJK Ideographs */
     };
 
-    /* Sorted list of non-overlapping intervals of all Emoji characters,
-     * based on http://unicode.org/emoji/charts/emoji-list.html */
-    static struct interval emoji_all[] =
-    {
-	{0x203c, 0x203c},
-	{0x2049, 0x2049},
-	{0x2122, 0x2122},
-	{0x2139, 0x2139},
-	{0x2194, 0x2199},
-	{0x21a9, 0x21aa},
-	{0x231a, 0x231b},
-	{0x2328, 0x2328},
-	{0x23cf, 0x23cf},
-	{0x23e9, 0x23f3},
-	{0x24c2, 0x24c2},
-	{0x25aa, 0x25ab},
-	{0x25b6, 0x25b6},
-	{0x25c0, 0x25c0},
-	{0x25fb, 0x25fe},
-	{0x2600, 0x2604},
-	{0x260e, 0x260e},
-	{0x2611, 0x2611},
-	{0x2614, 0x2615},
-	{0x2618, 0x2618},
-	{0x261d, 0x261d},
-	{0x2620, 0x2620},
-	{0x2622, 0x2623},
-	{0x2626, 0x2626},
-	{0x262a, 0x262a},
-	{0x262e, 0x262f},
-	{0x2638, 0x263a},
-	{0x2648, 0x2653},
-	{0x2660, 0x2660},
-	{0x2663, 0x2663},
-	{0x2665, 0x2666},
-	{0x2668, 0x2668},
-	{0x267b, 0x267b},
-	{0x267f, 0x267f},
-	{0x2692, 0x2694},
-	{0x2696, 0x2697},
-	{0x2699, 0x2699},
-	{0x269b, 0x269c},
-	{0x26a0, 0x26a1},
-	{0x26aa, 0x26ab},
-	{0x26b0, 0x26b1},
-	{0x26bd, 0x26be},
-	{0x26c4, 0x26c5},
-	{0x26c8, 0x26c8},
-	{0x26ce, 0x26cf},
-	{0x26d1, 0x26d1},
-	{0x26d3, 0x26d4},
-	{0x26e9, 0x26ea},
-	{0x26f0, 0x26f5},
-	{0x26f7, 0x26fa},
-	{0x26fd, 0x26fd},
-	{0x2702, 0x2702},
-	{0x2705, 0x2705},
-	{0x2708, 0x270d},
-	{0x270f, 0x270f},
-	{0x2712, 0x2712},
-	{0x2714, 0x2714},
-	{0x2716, 0x2716},
-	{0x271d, 0x271d},
-	{0x2721, 0x2721},
-	{0x2728, 0x2728},
-	{0x2733, 0x2734},
-	{0x2744, 0x2744},
-	{0x2747, 0x2747},
-	{0x274c, 0x274c},
-	{0x274e, 0x274e},
-	{0x2753, 0x2755},
-	{0x2757, 0x2757},
-	{0x2763, 0x2764},
-	{0x2795, 0x2797},
-	{0x27a1, 0x27a1},
-	{0x27b0, 0x27b0},
-	{0x27bf, 0x27bf},
-	{0x2934, 0x2935},
-	{0x2b05, 0x2b07},
-	{0x2b1b, 0x2b1c},
-	{0x2b50, 0x2b50},
-	{0x2b55, 0x2b55},
-	{0x3030, 0x3030},
-	{0x303d, 0x303d},
-	{0x3297, 0x3297},
-	{0x3299, 0x3299},
-	{0x1f004, 0x1f004},
-	{0x1f0cf, 0x1f0cf},
-	{0x1f170, 0x1f171},
-	{0x1f17e, 0x1f17f},
-	{0x1f18e, 0x1f18e},
-	{0x1f191, 0x1f19a},
-	{0x1f1e6, 0x1f1ff},
-	{0x1f201, 0x1f202},
-	{0x1f21a, 0x1f21a},
-	{0x1f22f, 0x1f22f},
-	{0x1f232, 0x1f23a},
-	{0x1f250, 0x1f251},
-	{0x1f300, 0x1f320},
-	{0x1f330, 0x1f335},
-	{0x1f337, 0x1f37c},
-	{0x1f380, 0x1f393},
-	{0x1f3a0, 0x1f3c4},
-	{0x1f3c6, 0x1f3ca},
-	{0x1f3e0, 0x1f3f0},
-	{0x1f400, 0x1f43e},
-	{0x1f440, 0x1f440},
-	{0x1f442, 0x1f4f7},
-	{0x1f4f9, 0x1f4fc},
-	{0x1f500, 0x1f53d},
-	{0x1f550, 0x1f567},
-	{0x1f5fb, 0x1f640},
-	{0x1f645, 0x1f64f},
-	{0x1f680, 0x1f6c5}
-    };
-
     int bot = 0;
     int top = sizeof(classes) / sizeof(struct clinterval) - 1;
     int mid;
@@ -2714,6 +2714,13 @@ utf_class(int c)
     return 2;
 }
 
+    int
+utf_ambiguous_width(int c)
+{
+    return c >= 0x80 && (intable(ambiguous, sizeof(ambiguous), c)
+	    || intable(emoji_all, sizeof(emoji_all), c));
+}
+
 /*
  * Code for Unicode case-dependent operations.  Based on notes in
  * http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
diff --git a/src/proto/mbyte.pro b/src/proto/mbyte.pro
index bb00a50..0e41a41 100644
--- a/src/proto/mbyte.pro
+++ b/src/proto/mbyte.pro
@@ -10,6 +10,7 @@ int latin_char2len(int c);
 int latin_char2bytes(int c, char_u *buf);
 int latin_ptr2len(char_u *p);
 int latin_ptr2len_len(char_u *p, int size);
+int utf_ambiguous_width(int c);
 int utf_char2cells(int c);
 int latin_ptr2cells(char_u *p);
 int utf_ptr2cells(char_u *p);
diff --git a/src/screen.c b/src/screen.c
index 77fb3b9..4c2b70c 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -8052,7 +8052,9 @@ screen_char(unsigned off, int row, int col)
 	buf[utfc_char2bytes(off, buf)] = NUL;
 
 	out_str(buf);
-	if (utf_char2cells(ScreenLinesUC[off]) > 1)
+	if (utf_ambiguous_width(ScreenLinesUC[off]))
+	    screen_cur_col = 9999;
+	else if (utf_char2cells(ScreenLinesUC[off]) > 1)
 	    ++screen_cur_col;
     }
     else
diff --git a/src/version.c b/src/version.c
index ab2cc39..cfca22e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -749,6 +749,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1697,
+/**/
     1696,
 /**/
     1695,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-vim/vim.git



More information about the pkg-vim-maintainers mailing list