diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-10-15 22:56:49 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-10-15 22:56:49 +0200 |
commit | 6daeef1933be68055aabe1d55f8467d46a707753 (patch) | |
tree | c39230aa296e11d9ed34767d0c22285d3ae5c0e3 /src/testdir | |
parent | 059db5c29ffef283a4b90bab9228708fa32e3dd2 (diff) | |
download | vim-git-6daeef1933be68055aabe1d55f8467d46a707753.tar.gz |
patch 8.0.1203: terminal window mistreats composing charactersv8.0.1203
Problem: Terminal window mistreats composing characters.
Solution: Count composing characters with the base character. (Ozaki Kiichi,
closes #2195)
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_terminal.vim | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index 92dcd1a57..bd7821d90 100644 --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -685,3 +685,60 @@ func Test_terminal_wall() exe buf . 'bwipe' unlet g:job endfunc + +func Test_terminal_composing_unicode() + let save_enc = &encoding + set encoding=utf-8 + + if has('win32') + let cmd = "cmd /K chcp 65001" + let lnum = [3, 6, 9] + else + let cmd = &shell + let lnum = [1, 3, 5] + endif + + enew + let buf = term_start(cmd, {'curwin': bufnr('')}) + let job = term_getjob(buf) + call term_wait(buf, 50) + + " ascii + composing + let txt = "a\u0308bc" + call term_sendkeys(buf, "echo " . txt . "\r") + call term_wait(buf, 50) + call assert_match("echo " . txt, term_getline(buf, lnum[0])) + call assert_equal(txt, term_getline(buf, lnum[0] + 1)) + let l = term_scrape(buf, lnum[0] + 1) + call assert_equal("a\u0308", l[0].chars) + call assert_equal("b", l[1].chars) + call assert_equal("c", l[2].chars) + + " multibyte + composing + let txt = "\u304b\u3099\u304e\u304f\u3099\u3052\u3053\u3099" + call term_sendkeys(buf, "echo " . txt . "\r") + call term_wait(buf, 50) + call assert_match("echo " . txt, term_getline(buf, lnum[1])) + call assert_equal(txt, term_getline(buf, lnum[1] + 1)) + let l = term_scrape(buf, lnum[1] + 1) + call assert_equal("\u304b\u3099", l[0].chars) + call assert_equal("\u304e", l[1].chars) + call assert_equal("\u304f\u3099", l[2].chars) + call assert_equal("\u3052", l[3].chars) + call assert_equal("\u3053\u3099", l[4].chars) + + " \u00a0 + composing + let txt = "abc\u00a0\u0308" + call term_sendkeys(buf, "echo " . txt . "\r") + call term_wait(buf, 50) + call assert_match("echo " . txt, term_getline(buf, lnum[2])) + call assert_equal(txt, term_getline(buf, lnum[2] + 1)) + let l = term_scrape(buf, lnum[2] + 1) + call assert_equal("\u00a0\u0308", l[3].chars) + + call term_sendkeys(buf, "exit\r") + call WaitFor('job_status(job) == "dead"') + call assert_equal('dead', job_status(job)) + bwipe! + let &encoding = save_enc +endfunc |