forked from aniani/vim
patch 8.2.2640: screenstring() returns non-existing composing characters
Problem: screenstring() returns non-existing composing characters. Solution: Only use composing characters if there is a base character.
This commit is contained in:
@@ -7902,7 +7902,7 @@ f_screenstring(typval_T *argvars, typval_T *rettv)
|
|||||||
c = ScreenLines[off];
|
c = ScreenLines[off];
|
||||||
buflen += mb_char2bytes(c, buf);
|
buflen += mb_char2bytes(c, buf);
|
||||||
|
|
||||||
if (enc_utf8)
|
if (enc_utf8 && ScreenLinesUC[off] != 0)
|
||||||
for (i = 0; i < Screen_mco && ScreenLinesC[i][off] != 0; ++i)
|
for (i = 0; i < Screen_mco && ScreenLinesC[i][off] != 0; ++i)
|
||||||
buflen += mb_char2bytes(ScreenLinesC[i][off], buf + buflen);
|
buflen += mb_char2bytes(ScreenLinesC[i][off], buf + buflen);
|
||||||
|
|
||||||
|
@@ -146,7 +146,7 @@ func Test_listchars()
|
|||||||
set list
|
set list
|
||||||
" Non-breaking space
|
" Non-breaking space
|
||||||
let nbsp = nr2char(0xa0)
|
let nbsp = nr2char(0xa0)
|
||||||
call append(0, [ ">".nbsp."<" ])
|
call append(0, [ ">" .. nbsp .. "<" ])
|
||||||
|
|
||||||
let expected = '>X< '
|
let expected = '>X< '
|
||||||
|
|
||||||
@@ -193,12 +193,8 @@ func Test_listchars_unicode()
|
|||||||
set list
|
set list
|
||||||
|
|
||||||
let nbsp = nr2char(0xa0)
|
let nbsp = nr2char(0xa0)
|
||||||
call append(0, [
|
call append(0, ["a\tb c" .. nbsp .. "d"])
|
||||||
\ "a\tb c".nbsp."d"
|
let expected = ['a←↔↔↔↔↔→b␣c≠d⇔']
|
||||||
\ ])
|
|
||||||
let expected = [
|
|
||||||
\ 'a←↔↔↔↔↔→b␣c≠d⇔'
|
|
||||||
\ ]
|
|
||||||
redraw!
|
redraw!
|
||||||
call cursor(1, 1)
|
call cursor(1, 1)
|
||||||
call assert_equal(expected, ScreenLines(1, virtcol('$')))
|
call assert_equal(expected, ScreenLines(1, virtcol('$')))
|
||||||
@@ -221,10 +217,10 @@ func Test_listchars_composing()
|
|||||||
let nbsp1 = nr2char(0xa0)
|
let nbsp1 = nr2char(0xa0)
|
||||||
let nbsp2 = nr2char(0x202f)
|
let nbsp2 = nr2char(0x202f)
|
||||||
call append(0, [
|
call append(0, [
|
||||||
\ " \u3099\t \u309A".nbsp1.nbsp1."\u0302".nbsp2.nbsp2."\u0302",
|
\ " \u3099\t \u309A" .. nbsp1 .. nbsp1 .. "\u0302" .. nbsp2 .. nbsp2 .. "\u0302",
|
||||||
\ ])
|
\ ])
|
||||||
let expected = [
|
let expected = [
|
||||||
\ "_ \u3099^I \u309A=".nbsp1."\u0302=".nbsp2."\u0302$"
|
\ "_ \u3099^I \u309A=" .. nbsp1 .. "\u0302=" .. nbsp2 .. "\u0302$"
|
||||||
\ ]
|
\ ]
|
||||||
redraw!
|
redraw!
|
||||||
call cursor(1, 1)
|
call cursor(1, 1)
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2640,
|
||||||
/**/
|
/**/
|
||||||
2639,
|
2639,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user