Mercurial > vim
comparison src/testdir/test_terminal.vim @ 23890:57c71d51e937
patch 8.2.2487: terminal shows garbage after double-wide character
Commit: https://github.com/vim/vim/commit/4549dad874244fe933b969e4ac0b41923ee70dc3
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Feb 8 21:29:48 2021 +0100
patch 8.2.2487: terminal shows garbage after double-wide character
Problem: Terminal shows garbage after double-wide character with a
combining character. (Kyoichiro Yamada)
Solution: Libvterm: do not add the width of the combining character to the
glyph width. (closes #7801)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 08 Feb 2021 21:30:06 +0100 |
parents | 1456b8e4d489 |
children | d9afd9008910 |
comparison
equal
deleted
inserted
replaced
23889:fd2c08bdaa2a | 23890:57c71d51e937 |
---|---|
963 let l = term_scrape(buf, lnum[0] + 1) | 963 let l = term_scrape(buf, lnum[0] + 1) |
964 call assert_equal("a\u0308", l[0].chars) | 964 call assert_equal("a\u0308", l[0].chars) |
965 call assert_equal("b", l[1].chars) | 965 call assert_equal("b", l[1].chars) |
966 call assert_equal("c", l[2].chars) | 966 call assert_equal("c", l[2].chars) |
967 | 967 |
968 " multibyte + composing | 968 " multibyte + composing: がぎぐげご |
969 let txt = "\u304b\u3099\u304e\u304f\u3099\u3052\u3053\u3099" | 969 let txt = "\u304b\u3099\u304e\u304f\u3099\u3052\u3053\u3099" |
970 call term_sendkeys(buf, "echo " . txt) | 970 call term_sendkeys(buf, "echo " . txt) |
971 call TermWait(buf, 25) | 971 call TermWait(buf, 25) |
972 call assert_match("echo " . txt, term_getline(buf, lnum[1])) | 972 call assert_match("echo " . txt, term_getline(buf, lnum[1])) |
973 call term_sendkeys(buf, "\<cr>") | 973 call term_sendkeys(buf, "\<cr>") |
974 call WaitForAssert({-> assert_equal(txt, term_getline(buf, lnum[1] + 1))}, 1000) | 974 call WaitForAssert({-> assert_equal(txt, term_getline(buf, lnum[1] + 1))}, 1000) |
975 let l = term_scrape(buf, lnum[1] + 1) | 975 let l = term_scrape(buf, lnum[1] + 1) |
976 call assert_equal("\u304b\u3099", l[0].chars) | 976 call assert_equal("\u304b\u3099", l[0].chars) |
977 call assert_equal("\u304e", l[2].chars) | 977 call assert_equal(2, l[0].width) |
978 call assert_equal("\u304f\u3099", l[3].chars) | 978 call assert_equal("\u304e", l[1].chars) |
979 call assert_equal("\u3052", l[5].chars) | 979 call assert_equal(2, l[1].width) |
980 call assert_equal("\u3053\u3099", l[6].chars) | 980 call assert_equal("\u304f\u3099", l[2].chars) |
981 call assert_equal(2, l[2].width) | |
982 call assert_equal("\u3052", l[3].chars) | |
983 call assert_equal(2, l[3].width) | |
984 call assert_equal("\u3053\u3099", l[4].chars) | |
985 call assert_equal(2, l[4].width) | |
981 | 986 |
982 " \u00a0 + composing | 987 " \u00a0 + composing |
983 let txt = "abc\u00a0\u0308" | 988 let txt = "abc\u00a0\u0308" |
984 call term_sendkeys(buf, "echo " . txt) | 989 call term_sendkeys(buf, "echo " . txt) |
985 call TermWait(buf, 25) | 990 call TermWait(buf, 25) |
1240 call term_sendkeys(buf, "\<Esc>") | 1245 call term_sendkeys(buf, "\<Esc>") |
1241 call term_sendkeys(buf, ":q\<CR>") | 1246 call term_sendkeys(buf, ":q\<CR>") |
1242 | 1247 |
1243 call StopVimInTerminal(buf) | 1248 call StopVimInTerminal(buf) |
1244 call delete('Xopenterm') | 1249 call delete('Xopenterm') |
1250 endfunc | |
1251 | |
1252 func Test_combining_double_width() | |
1253 CheckUnix | |
1254 CheckRunVimInTerminal | |
1255 | |
1256 call writefile(["\xe3\x83\x9b\xe3\x82\x9a"], 'Xonedouble') | |
1257 let lines =<< trim END | |
1258 call term_start(['/bin/sh', '-c', 'cat Xonedouble']) | |
1259 END | |
1260 call writefile(lines, 'Xcombining') | |
1261 let buf = RunVimInTerminal('-S Xcombining', #{rows: 9}) | |
1262 | |
1263 " this opens a window, incsearch should not use the old cursor position | |
1264 call VerifyScreenDump(buf, 'Test_terminal_combining', {}) | |
1265 call term_sendkeys(buf, ":q\<CR>") | |
1266 | |
1267 call StopVimInTerminal(buf) | |
1268 call delete('Xonedouble') | |
1269 call delete('Xcombining') | |
1245 endfunc | 1270 endfunc |
1246 | 1271 |
1247 func Test_terminal_popup_with_cmd() | 1272 func Test_terminal_popup_with_cmd() |
1248 " this was crashing | 1273 " this was crashing |
1249 let buf = term_start(&shell, #{hidden: v:true}) | 1274 let buf = term_start(&shell, #{hidden: v:true}) |