summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-03-29 17:22:24 +0200
committerBram Moolenaar <Bram@vim.org>2018-03-29 17:22:24 +0200
commitf06b0b6c8f85ea9c320f2be30b25ed084969c1e2 (patch)
tree96efb9e8505b7eee64c6b3ea57ba55d83be50efc
parent0751f51a5b428805a8c1e9fe529693d032bec991 (diff)
downloadvim-git-f06b0b6c8f85ea9c320f2be30b25ed084969c1e2.tar.gz
patch 8.0.1652: term_dumpwrite() does not output composing charactersv8.0.1652
Problem: term_dumpwrite() does not output composing characters. Solution: Use the cell index.
-rw-r--r--src/terminal.c2
-rw-r--r--src/testdir/test_terminal.vim22
-rw-r--r--src/version.c2
3 files changed, 25 insertions, 1 deletions
diff --git a/src/terminal.c b/src/terminal.c
index 5875af6e6..b60799d7f 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -3573,7 +3573,7 @@ f_term_dumpwrite(typval_T *argvars, typval_T *rettv UNUSED)
for (i = 0; i < VTERM_MAX_CHARS_PER_CELL
&& cell.chars[i] != NUL; ++i)
{
- len = utf_char2bytes(cell.chars[0], charbuf);
+ len = utf_char2bytes(cell.chars[i], charbuf);
fwrite(charbuf, len, 1, fd);
}
}
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 5e817dee0..d0ef3250e 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -978,6 +978,28 @@ func Check_dump01(off)
call assert_equal(':popup PopUp :', trim(getline(a:off + 20)))
endfunc
+func Test_terminal_dumpwrite_composing()
+ if !CanRunVimInTerminal()
+ return
+ endif
+ let save_enc = &encoding
+ set encoding=utf-8
+ call assert_equal(1, winnr('$'))
+
+ let text = " a\u0300 e\u0302 o\u0308"
+ call writefile([text], 'Xcomposing')
+ let buf = RunVimInTerminal('Xcomposing', {})
+ call WaitFor({-> term_getline(buf, 1) =~ text})
+ call term_dumpwrite(buf, 'Xdump')
+ let dumpline = readfile('Xdump')[0]
+ call assert_match('|à| |ê| |ö', dumpline)
+
+ call StopVimInTerminal(buf)
+ call delete('Xcomposing')
+ call delete('Xdump')
+ let &encoding = save_enc
+endfunc
+
" just testing basic functionality.
func Test_terminal_dumpload()
call assert_equal(1, winnr('$'))
diff --git a/src/version.c b/src/version.c
index 40746fe2e..b709f71aa 100644
--- a/src/version.c
+++ b/src/version.c
@@ -763,6 +763,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1652,
+/**/
1651,
/**/
1650,