]> granicus.if.org Git - vim/commitdiff
patch 8.0.1652: term_dumpwrite() does not output composing characters v8.0.1652
authorBram Moolenaar <Bram@vim.org>
Thu, 29 Mar 2018 15:22:24 +0000 (17:22 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 29 Mar 2018 15:22:24 +0000 (17:22 +0200)
Problem:    term_dumpwrite() does not output composing characters.
Solution:   Use the cell index.

src/terminal.c
src/testdir/test_terminal.vim
src/version.c

index 5875af6e68a791810a7bb392cc1bb30b251abfcf..b60799d7f1237cceb2f8dffbdbf0a9c3bd9c3451 100644 (file)
@@ -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);
                    }
                }
index 5e817dee04e5a8d511afaa8202537cb3392d7ff2..d0ef3250e0f3a31d4c33793fecf77490af835ad6 100644 (file)
@@ -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('$'))
index 40746fe2e1e981322895e771421b5cf48e755ada..b709f71aa0f62d6c4ee52f7ae899f4ceb940b0f8 100644 (file)
@@ -762,6 +762,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1652,
 /**/
     1651,
 /**/