Skip to content

Commit f06b0b6

Browse files
committed
patch 8.0.1652: term_dumpwrite() does not output composing characters
Problem: term_dumpwrite() does not output composing characters. Solution: Use the cell index.
1 parent 0751f51 commit f06b0b6

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

src/terminal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3573,7 +3573,7 @@ f_term_dumpwrite(typval_T *argvars, typval_T *rettv UNUSED)
35733573
for (i = 0; i < VTERM_MAX_CHARS_PER_CELL
35743574
&& cell.chars[i] != NUL; ++i)
35753575
{
3576-
len = utf_char2bytes(cell.chars[0], charbuf);
3576+
len = utf_char2bytes(cell.chars[i], charbuf);
35773577
fwrite(charbuf, len, 1, fd);
35783578
}
35793579
}

src/testdir/test_terminal.vim

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,28 @@ func Check_dump01(off)
978978
call assert_equal(':popup PopUp :', trim(getline(a:off + 20)))
979979
endfunc
980980

981+
func Test_terminal_dumpwrite_composing()
982+
if !CanRunVimInTerminal()
983+
return
984+
endif
985+
let save_enc = &encoding
986+
set encoding=utf-8
987+
call assert_equal(1, winnr('$'))
988+
989+
let text = " a\u0300 e\u0302 o\u0308"
990+
call writefile([text], 'Xcomposing')
991+
let buf = RunVimInTerminal('Xcomposing', {})
992+
call WaitFor({-> term_getline(buf, 1) =~ text})
993+
call term_dumpwrite(buf, 'Xdump')
994+
let dumpline = readfile('Xdump')[0]
995+
call assert_match('|à| |ê| |ö', dumpline)
996+
997+
call StopVimInTerminal(buf)
998+
call delete('Xcomposing')
999+
call delete('Xdump')
1000+
let &encoding = save_enc
1001+
endfunc
1002+
9811003
" just testing basic functionality.
9821004
func Test_terminal_dumpload()
9831005
call assert_equal(1, winnr('$'))

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,8 @@ static char *(features[]) =
762762

763763
static int included_patches[] =
764764
{ /* Add new patch number below this line */
765+
/**/
766+
1652,
765767
/**/
766768
1651,
767769
/**/

0 commit comments

Comments
 (0)