Skip to content

Commit 3678393

Browse files
committed
patch 8.0.0943: MS-Windows: Test_terminal_scrape_multibyte may fail
Problem: Test_terminal_scrape_multibyte fails if the codepage is not utf-8. Solution: Start "cmd" with the utf-8 codepage. (micbou, closes #1975)
1 parent 4fa1019 commit 3678393

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

src/testdir/test_terminal.vim

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,19 @@ func Test_terminal_scrape_multibyte()
185185
endif
186186
call writefile(["léttまrs"], 'Xtext')
187187
if has('win32')
188-
let cmd = 'cmd /c "type Xtext"'
188+
" Run cmd with UTF-8 codepage to make the type command print the expected
189+
" multibyte characters.
190+
let g:buf = term_start("cmd /K chcp 65001")
191+
call term_sendkeys(g:buf, "type Xtext\<CR>")
192+
call term_sendkeys(g:buf, "exit\<CR>")
193+
let g:line = 4
189194
else
190-
let cmd = "cat Xtext"
195+
let g:buf = term_start("cat Xtext")
196+
let g:line = 1
191197
endif
192-
let g:buf = term_start(cmd)
193198

194-
call WaitFor('term_scrape(g:buf, 1)[0].chars == "l"')
195-
let l = term_scrape(g:buf, 1)
199+
call WaitFor('term_scrape(g:buf, g:line)[0].chars == "l"')
200+
let l = term_scrape(g:buf, g:line)
196201
call assert_true(len(l) >= 7)
197202
call assert_equal('l', l[0].chars)
198203
call assert_equal('é', l[1].chars)
@@ -210,6 +215,7 @@ func Test_terminal_scrape_multibyte()
210215

211216
exe g:buf . 'bwipe'
212217
unlet g:buf
218+
unlet g:line
213219
call delete('Xtext')
214220
endfunc
215221

src/version.c

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

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
943,
772774
/**/
773775
942,
774776
/**/

0 commit comments

Comments
 (0)