On Saturday, December 6, 2014 7:55:34 PM UTC+3, ZyX wrote:
> On Friday, December 5, 2014 10:54:45 PM UTC+3, Christian Brabandt wrote:
> > Hi Bram!
> > 
> > On Fr, 05 Dez 2014, Bram Moolenaar wrote:
> > 
> > > ZyX wrote:
> > > 
> > > > Consider the following script:
> > > > 
> > > >     echo strwidth(nr2char(0x1F48E))
> > > > 
> > > > . It should display “2” because 0x1F48E is a fullwidth ruby symbol.
> > > > But Vim actually displays “1”. This causes rendering bugs at least in
> > > > terminal because unlike Vim terminal (Konsole) knows that ruby symbol
> > > > occupies two display cells. Problem can be observed with the following
> > > > script:
> > > > 
> > > >     vim -u NONE -i NONE -N --cmd 'set encoding=utf-8' -c 'call 
> > > > setline(".", ["(" . nr2char(0xFF21) . ")", "(" . nr2char(0x1F48E) . 
> > > > ")"])' -c 'normal! G$'
> > > > 
> > > > . Display bug: 
> > > > http://img-fotki.yandex.ru/get/15583/9151298.5/0_af494_e6a1fc7e_orig.png:
> > > > 
> > > >     (A)
> > > >     (█☐)
> > > > 
> > > > (where third character on second line character is the inversed
> > > > version of the first one: black box with white frame) with cursor on
> > > > the third character on the second line in place of
> > > > 
> > > >     (A)
> > > >     (𐟒Ž)
> > > > 
> > > > with cursor on the last parenthesis. Vim version is 7.4.540 (from 
> > > > https://bitbucket.org/ZyX_I/vim/changeset/b96a442ce32c1747da2b07ca3410217ba2f38d8d).
> > > 
> > > Are these new Unicode characters?  Then we need to update the tables in
> > > mbyte.c.  See the comment in utf_char2cells().  Or is this another
> > > problem?
> > 
> > While it seems that U+1F48E is no character, that has been added with 
> > the release of unicode 7.0 in June, that version added many different 
> > new characters and even new blocks. See here:
> > http://www.unicode.org/charts/PDF/Unicode-7.0/
> > 
> > Quoting from 
> > https://groups.google.com/d/msg/vim_dev/w8jUb7zs5F0/Qx-Be3zKWYoJ
> > 
> > ,----
> > | With the release of the Unicode version 7.0 yesterday, the rouble sign
> > | has been assigned U+20BD. It probably makes sense to update all the
> > | generated unicode data in the Vim source however. 
> > `----
> > 
> > Best,
> > Christian
> > -- 
> > In einer Konsumgesellschaft gibt es zwangsläufig zwei Arten von Sklaven:
> > Die Gefangenen der Sucht und die Gefangenen des Neids.
> 
> Running the script (“vim -u <(<<< $'set runtimepath=$VIMRUNTIME') -N -i NONE 
> -S runtime/tools/unicode.vim”) and pasting the results into mbyte.c produces 
> the following diff. I have not yet tried this patch out though.
> 
> diff -r 4604a182f04c src/mbyte.c
> --- a/src/mbyte.c     Вс ноя 30 22:51:06 2014 +0100
> +++ b/src/mbyte.c     Сб дек 06 19:53:46 2014 +0300
> @@ -1244,20 +1244,17 @@ utf_char2cells(c)
>      static struct interval doublewidth[] =
>      {
>       {0x1100, 0x115f},
> -     {0x11a3, 0x11a7},
> -     {0x11fa, 0x11ff},
>       {0x2329, 0x232a},
>       {0x2e80, 0x2e99},
>       {0x2e9b, 0x2ef3},
>       {0x2f00, 0x2fd5},
>       {0x2ff0, 0x2ffb},
> -     {0x3000, 0x3029},
> -     {0x3030, 0x303e},
> +     {0x3000, 0x303e},
>       {0x3041, 0x3096},
> -     {0x309b, 0x30ff},
> +     {0x3099, 0x30ff},
>       {0x3105, 0x312d},
>       {0x3131, 0x318e},
> -     {0x3190, 0x31b7},
> +     {0x3190, 0x31ba},
>       {0x31c0, 0x31e3},
>       {0x31f0, 0x321e},
>       {0x3220, 0x3247},
> @@ -1267,8 +1264,6 @@ utf_char2cells(c)
>       {0xa490, 0xa4c6},
>       {0xa960, 0xa97c},
>       {0xac00, 0xd7a3},
> -     {0xd7b0, 0xd7c6},
> -     {0xd7cb, 0xd7fb},
>       {0xf900, 0xfaff},
>       {0xfe10, 0xfe19},
>       {0xfe30, 0xfe52},
> @@ -1276,9 +1271,11 @@ utf_char2cells(c)
>       {0xfe68, 0xfe6b},
>       {0xff01, 0xff60},
>       {0xffe0, 0xffe6},
> -     {0x1f200, 0x1f200},
> -     {0x1f210, 0x1f231},
> +     {0x1b000, 0x1b001},
> +     {0x1f200, 0x1f202},
> +     {0x1f210, 0x1f23a},
>       {0x1f240, 0x1f248},
> +     {0x1f250, 0x1f251},
>       {0x20000, 0x2fffd},
>       {0x30000, 0x3fffd}
>      };
> @@ -1339,6 +1336,7 @@ utf_char2cells(c)
>       {0x02d8, 0x02db},
>       {0x02dd, 0x02dd},
>       {0x02df, 0x02df},
> +     {0x0300, 0x036f},
>       {0x0391, 0x03a1},
>       {0x03a3, 0x03a9},
>       {0x03b1, 0x03c1},
> @@ -1449,22 +1447,13 @@ utf_char2cells(c)
>       {0x2b55, 0x2b59},
>       {0x3248, 0x324f},
>       {0xe000, 0xf8ff},
> +     {0xfe00, 0xfe0f},
>       {0xfffd, 0xfffd},
>       {0x1f100, 0x1f10a},
>       {0x1f110, 0x1f12d},
> -     {0x1f131, 0x1f131},
> -     {0x1f13d, 0x1f13d},
> -     {0x1f13f, 0x1f13f},
> -     {0x1f142, 0x1f142},
> -     {0x1f146, 0x1f146},
> -     {0x1f14a, 0x1f14e},
> -     {0x1f157, 0x1f157},
> -     {0x1f15f, 0x1f15f},
> -     {0x1f179, 0x1f179},
> -     {0x1f17b, 0x1f17c},
> -     {0x1f17f, 0x1f17f},
> -     {0x1f18a, 0x1f18d},
> -     {0x1f190, 0x1f190},
> +     {0x1f130, 0x1f169},
> +     {0x1f170, 0x1f19a},
> +     {0xe0100, 0xe01ef},
>       {0xf0000, 0xffffd},
>       {0x100000, 0x10fffd}
>      };
> @@ -2261,10 +2250,10 @@ utf_iscomposing(c)
>       {0x05c4, 0x05c5},
>       {0x05c7, 0x05c7},
>       {0x0610, 0x061a},
> -     {0x064b, 0x065e},
> +     {0x064b, 0x065f},
>       {0x0670, 0x0670},
>       {0x06d6, 0x06dc},
> -     {0x06de, 0x06e4},
> +     {0x06df, 0x06e4},
>       {0x06e7, 0x06e8},
>       {0x06ea, 0x06ed},
>       {0x0711, 0x0711},
> @@ -2275,10 +2264,11 @@ utf_iscomposing(c)
>       {0x081b, 0x0823},
>       {0x0825, 0x0827},
>       {0x0829, 0x082d},
> -     {0x0900, 0x0903},
> -     {0x093c, 0x093c},
> -     {0x093e, 0x094e},
> -     {0x0951, 0x0955},
> +     {0x0859, 0x085b},
> +     {0x08e4, 0x0903},
> +     {0x093a, 0x093c},
> +     {0x093e, 0x094f},
> +     {0x0951, 0x0957},
>       {0x0962, 0x0963},
>       {0x0981, 0x0983},
>       {0x09bc, 0x09bc},
> @@ -2313,20 +2303,20 @@ utf_iscomposing(c)
>       {0x0bc6, 0x0bc8},
>       {0x0bca, 0x0bcd},
>       {0x0bd7, 0x0bd7},
> -     {0x0c01, 0x0c03},
> +     {0x0c00, 0x0c03},
>       {0x0c3e, 0x0c44},
>       {0x0c46, 0x0c48},
>       {0x0c4a, 0x0c4d},
>       {0x0c55, 0x0c56},
>       {0x0c62, 0x0c63},
> -     {0x0c82, 0x0c83},
> +     {0x0c81, 0x0c83},
>       {0x0cbc, 0x0cbc},
>       {0x0cbe, 0x0cc4},
>       {0x0cc6, 0x0cc8},
>       {0x0cca, 0x0ccd},
>       {0x0cd5, 0x0cd6},
>       {0x0ce2, 0x0ce3},
> -     {0x0d02, 0x0d03},
> +     {0x0d01, 0x0d03},
>       {0x0d3e, 0x0d44},
>       {0x0d46, 0x0d48},
>       {0x0d4a, 0x0d4d},
> @@ -2352,7 +2342,7 @@ utf_iscomposing(c)
>       {0x0f3e, 0x0f3f},
>       {0x0f71, 0x0f84},
>       {0x0f86, 0x0f87},
> -     {0x0f90, 0x0f97},
> +     {0x0f8d, 0x0f97},
>       {0x0f99, 0x0fbc},
>       {0x0fc6, 0x0fc6},
>       {0x102b, 0x103e},
> @@ -2364,12 +2354,12 @@ utf_iscomposing(c)
>       {0x1082, 0x108d},
>       {0x108f, 0x108f},
>       {0x109a, 0x109d},
> -     {0x135f, 0x135f},
> +     {0x135d, 0x135f},
>       {0x1712, 0x1714},
>       {0x1732, 0x1734},
>       {0x1752, 0x1753},
>       {0x1772, 0x1773},
> -     {0x17b6, 0x17d3},
> +     {0x17b4, 0x17d3},
>       {0x17dd, 0x17dd},
>       {0x180b, 0x180d},
>       {0x18a9, 0x18a9},
> @@ -2381,25 +2371,30 @@ utf_iscomposing(c)
>       {0x1a55, 0x1a5e},
>       {0x1a60, 0x1a7c},
>       {0x1a7f, 0x1a7f},
> +     {0x1ab0, 0x1abe},
>       {0x1b00, 0x1b04},
>       {0x1b34, 0x1b44},
>       {0x1b6b, 0x1b73},
>       {0x1b80, 0x1b82},
> -     {0x1ba1, 0x1baa},
> +     {0x1ba1, 0x1bad},
> +     {0x1be6, 0x1bf3},
>       {0x1c24, 0x1c37},
>       {0x1cd0, 0x1cd2},
>       {0x1cd4, 0x1ce8},
>       {0x1ced, 0x1ced},
> -     {0x1cf2, 0x1cf2},
> -     {0x1dc0, 0x1de6},
> -     {0x1dfd, 0x1dff},
> +     {0x1cf2, 0x1cf4},
> +     {0x1cf8, 0x1cf9},
> +     {0x1dc0, 0x1df5},
> +     {0x1dfc, 0x1dff},
>       {0x20d0, 0x20f0},
>       {0x2cef, 0x2cf1},
> +     {0x2d7f, 0x2d7f},
>       {0x2de0, 0x2dff},
>       {0x302a, 0x302f},
>       {0x3099, 0x309a},
>       {0xa66f, 0xa672},
> -     {0xa67c, 0xa67d},
> +     {0xa674, 0xa67d},
> +     {0xa69f, 0xa69f},
>       {0xa6f0, 0xa6f1},
>       {0xa802, 0xa802},
>       {0xa806, 0xa806},
> @@ -2412,34 +2407,69 @@ utf_iscomposing(c)
>       {0xa947, 0xa953},
>       {0xa980, 0xa983},
>       {0xa9b3, 0xa9c0},
> +     {0xa9e5, 0xa9e5},
>       {0xaa29, 0xaa36},
>       {0xaa43, 0xaa43},
>       {0xaa4c, 0xaa4d},
> -     {0xaa7b, 0xaa7b},
> +     {0xaa7b, 0xaa7d},
>       {0xaab0, 0xaab0},
>       {0xaab2, 0xaab4},
>       {0xaab7, 0xaab8},
>       {0xaabe, 0xaabf},
>       {0xaac1, 0xaac1},
> +     {0xaaeb, 0xaaef},
> +     {0xaaf5, 0xaaf6},
>       {0xabe3, 0xabea},
>       {0xabec, 0xabed},
>       {0xfb1e, 0xfb1e},
>       {0xfe00, 0xfe0f},
> -     {0xfe20, 0xfe26},
> +     {0xfe20, 0xfe2d},
>       {0x101fd, 0x101fd},
> +     {0x102e0, 0x102e0},
> +     {0x10376, 0x1037a},
>       {0x10a01, 0x10a03},
>       {0x10a05, 0x10a06},
>       {0x10a0c, 0x10a0f},
>       {0x10a38, 0x10a3a},
>       {0x10a3f, 0x10a3f},
> -     {0x11080, 0x11082},
> +     {0x10ae5, 0x10ae6},
> +     {0x11000, 0x11002},
> +     {0x11038, 0x11046},
> +     {0x1107f, 0x11082},
>       {0x110b0, 0x110ba},
> +     {0x11100, 0x11102},
> +     {0x11127, 0x11134},
> +     {0x11173, 0x11173},
> +     {0x11180, 0x11182},
> +     {0x111b3, 0x111c0},
> +     {0x1122c, 0x11237},
> +     {0x112df, 0x112ea},
> +     {0x11301, 0x11303},
> +     {0x1133c, 0x1133c},
> +     {0x1133e, 0x11344},
> +     {0x11347, 0x11348},
> +     {0x1134b, 0x1134d},
> +     {0x11357, 0x11357},
> +     {0x11362, 0x11363},
> +     {0x11366, 0x1136c},
> +     {0x11370, 0x11374},
> +     {0x114b0, 0x114c3},
> +     {0x115af, 0x115b5},
> +     {0x115b8, 0x115c0},
> +     {0x11630, 0x11640},
> +     {0x116ab, 0x116b7},
> +     {0x16af0, 0x16af4},
> +     {0x16b30, 0x16b36},
> +     {0x16f51, 0x16f7e},
> +     {0x16f8f, 0x16f92},
> +     {0x1bc9d, 0x1bc9e},
>       {0x1d165, 0x1d169},
>       {0x1d16d, 0x1d172},
>       {0x1d17b, 0x1d182},
>       {0x1d185, 0x1d18b},
>       {0x1d1aa, 0x1d1ad},
>       {0x1d242, 0x1d244},
> +     {0x1e8d0, 0x1e8d6},
>       {0xe0100, 0xe01ef}
>      };
>  
> @@ -2679,6 +2709,7 @@ static convertStruct foldCase[] =
>       {0x345,0x345,-1,116},
>       {0x370,0x372,2,1},
>       {0x376,0x376,-1,1},
> +     {0x37f,0x37f,-1,116},
>       {0x386,0x386,-1,38},
>       {0x388,0x38a,1,37},
>       {0x38c,0x38c,-1,64},
> @@ -2706,9 +2737,10 @@ static convertStruct foldCase[] =
>       {0x48a,0x4be,2,1},
>       {0x4c0,0x4c0,-1,15},
>       {0x4c1,0x4cd,2,1},
> -     {0x4d0,0x524,2,1},
> +     {0x4d0,0x52e,2,1},
>       {0x531,0x556,1,48},
>       {0x10a0,0x10c5,1,7264},
> +     {0x10c7,0x10cd,6,7264},
>       {0x1e00,0x1e94,2,1},
>       {0x1e9b,0x1e9b,-1,-58},
>       {0x1e9e,0x1e9e,-1,-7615},
> @@ -2758,17 +2790,27 @@ static convertStruct foldCase[] =
>       {0x2c7e,0x2c7f,1,-10815},
>       {0x2c80,0x2ce2,2,1},
>       {0x2ceb,0x2ced,2,1},
> -     {0xa640,0xa65e,2,1},
> -     {0xa662,0xa66c,2,1},
> -     {0xa680,0xa696,2,1},
> +     {0x2cf2,0xa640,31054,1},
> +     {0xa642,0xa66c,2,1},
> +     {0xa680,0xa69a,2,1},
>       {0xa722,0xa72e,2,1},
>       {0xa732,0xa76e,2,1},
>       {0xa779,0xa77b,2,1},
>       {0xa77d,0xa77d,-1,-35332},
>       {0xa77e,0xa786,2,1},
>       {0xa78b,0xa78b,-1,1},
> +     {0xa78d,0xa78d,-1,-42280},
> +     {0xa790,0xa792,2,1},
> +     {0xa796,0xa7a8,2,1},
> +     {0xa7aa,0xa7aa,-1,-42308},
> +     {0xa7ab,0xa7ab,-1,-42319},
> +     {0xa7ac,0xa7ac,-1,-42315},
> +     {0xa7ad,0xa7ad,-1,-42305},
> +     {0xa7b0,0xa7b0,-1,-42258},
> +     {0xa7b1,0xa7b1,-1,-42282},
>       {0xff21,0xff3a,1,32},
> -     {0x10400,0x10427,1,40}
> +     {0x10400,0x10427,1,40},
> +     {0x118a0,0x118bf,1,32}
>  };
>  
>  static int utf_convert __ARGS((int a, convertStruct table[], int tableSize));
> @@ -2885,6 +2927,7 @@ static convertStruct toLower[] =
>       {0x246,0x24e,2,1},
>       {0x370,0x372,2,1},
>       {0x376,0x376,-1,1},
> +     {0x37f,0x37f,-1,116},
>       {0x386,0x386,-1,38},
>       {0x388,0x38a,1,37},
>       {0x38c,0x38c,-1,64},
> @@ -2904,9 +2947,10 @@ static convertStruct toLower[] =
>       {0x48a,0x4be,2,1},
>       {0x4c0,0x4c0,-1,15},
>       {0x4c1,0x4cd,2,1},
> -     {0x4d0,0x524,2,1},
> +     {0x4d0,0x52e,2,1},
>       {0x531,0x556,1,48},
>       {0x10a0,0x10c5,1,7264},
> +     {0x10c7,0x10cd,6,7264},
>       {0x1e00,0x1e94,2,1},
>       {0x1e9e,0x1e9e,-1,-7615},
>       {0x1ea0,0x1efe,2,1},
> @@ -2954,24 +2998,34 @@ static convertStruct toLower[] =
>       {0x2c7e,0x2c7f,1,-10815},
>       {0x2c80,0x2ce2,2,1},
>       {0x2ceb,0x2ced,2,1},
> -     {0xa640,0xa65e,2,1},
> -     {0xa662,0xa66c,2,1},
> -     {0xa680,0xa696,2,1},
> +     {0x2cf2,0xa640,31054,1},
> +     {0xa642,0xa66c,2,1},
> +     {0xa680,0xa69a,2,1},
>       {0xa722,0xa72e,2,1},
>       {0xa732,0xa76e,2,1},
>       {0xa779,0xa77b,2,1},
>       {0xa77d,0xa77d,-1,-35332},
>       {0xa77e,0xa786,2,1},
>       {0xa78b,0xa78b,-1,1},
> +     {0xa78d,0xa78d,-1,-42280},
> +     {0xa790,0xa792,2,1},
> +     {0xa796,0xa7a8,2,1},
> +     {0xa7aa,0xa7aa,-1,-42308},
> +     {0xa7ab,0xa7ab,-1,-42319},
> +     {0xa7ac,0xa7ac,-1,-42315},
> +     {0xa7ad,0xa7ad,-1,-42305},
> +     {0xa7b0,0xa7b0,-1,-42258},
> +     {0xa7b1,0xa7b1,-1,-42282},
>       {0xff21,0xff3a,1,32},
> -     {0x10400,0x10427,1,40}
> +     {0x10400,0x10427,1,40},
> +     {0x118a0,0x118bf,1,32}
>  };
>  
>  static convertStruct toUpper[] =
>  {
>       {0x61,0x7a,1,-32},
>       {0xb5,0xb5,-1,743},
> -     {0xe0,0xf6,1,-32},  /* 0xdf (German sharp s) is not upper-cased */
> +     {0xe0,0xf6,1,-32},
>       {0xf8,0xfe,1,-32},
>       {0xff,0xff,-1,121},
>       {0x101,0x12f,2,-1},
> @@ -3021,22 +3075,29 @@ static convertStruct toUpper[] =
>       {0x256,0x257,1,-205},
>       {0x259,0x259,-1,-202},
>       {0x25b,0x25b,-1,-203},
> +     {0x25c,0x25c,-1,42319},
>       {0x260,0x260,-1,-205},
> +     {0x261,0x261,-1,42315},
>       {0x263,0x263,-1,-207},
> +     {0x265,0x265,-1,42280},
> +     {0x266,0x266,-1,42308},
>       {0x268,0x268,-1,-209},
>       {0x269,0x269,-1,-211},
>       {0x26b,0x26b,-1,10743},
> +     {0x26c,0x26c,-1,42305},
>       {0x26f,0x26f,-1,-211},
>       {0x271,0x271,-1,10749},
>       {0x272,0x272,-1,-213},
>       {0x275,0x275,-1,-214},
>       {0x27d,0x27d,-1,10727},
>       {0x280,0x283,3,-218},
> +     {0x287,0x287,-1,42282},
>       {0x288,0x288,-1,-218},
>       {0x289,0x289,-1,-69},
>       {0x28a,0x28b,1,-217},
>       {0x28c,0x28c,-1,-71},
>       {0x292,0x292,-1,-219},
> +     {0x29e,0x29e,-1,42258},
>       {0x345,0x345,-1,84},
>       {0x371,0x373,2,-1},
>       {0x377,0x377,-1,-1},
> @@ -3057,6 +3118,7 @@ static convertStruct toUpper[] =
>       {0x3f0,0x3f0,-1,-86},
>       {0x3f1,0x3f1,-1,-80},
>       {0x3f2,0x3f2,-1,7},
> +     {0x3f3,0x3f3,-1,-116},
>       {0x3f5,0x3f5,-1,-96},
>       {0x3f8,0x3fb,3,-1},
>       {0x430,0x44f,1,-32},
> @@ -3065,7 +3127,7 @@ static convertStruct toUpper[] =
>       {0x48b,0x4bf,2,-1},
>       {0x4c2,0x4ce,2,-1},
>       {0x4cf,0x4cf,-1,-15},
> -     {0x4d1,0x525,2,-1},
> +     {0x4d1,0x52f,2,-1},
>       {0x561,0x586,1,-48},
>       {0x1d79,0x1d79,-1,35332},
>       {0x1d7d,0x1d7d,-1,3814},
> @@ -3108,17 +3170,21 @@ static convertStruct toUpper[] =
>       {0x2c73,0x2c76,3,-1},
>       {0x2c81,0x2ce3,2,-1},
>       {0x2cec,0x2cee,2,-1},
> +     {0x2cf3,0x2cf3,-1,-1},
>       {0x2d00,0x2d25,1,-7264},
> -     {0xa641,0xa65f,2,-1},
> -     {0xa663,0xa66d,2,-1},
> -     {0xa681,0xa697,2,-1},
> +     {0x2d27,0x2d2d,6,-7264},
> +     {0xa641,0xa66d,2,-1},
> +     {0xa681,0xa69b,2,-1},
>       {0xa723,0xa72f,2,-1},
>       {0xa733,0xa76f,2,-1},
>       {0xa77a,0xa77c,2,-1},
>       {0xa77f,0xa787,2,-1},
> -     {0xa78c,0xa78c,-1,-1},
> +     {0xa78c,0xa791,5,-1},
> +     {0xa793,0xa797,4,-1},
> +     {0xa799,0xa7a9,2,-1},
>       {0xff41,0xff5a,1,-32},
> -     {0x10428,0x1044f,1,-40}
> +     {0x10428,0x1044f,1,-40},
> +     {0x118c0,0x118df,1,-32}
>  };
>  
>  /*

This patch does not work: there are still the same issues.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui