Mercurial > vim
comparison src/testdir/test_terminal.vim @ 12650:f58755eb453e v8.0.1203
patch 8.0.1203: terminal window mistreats composing characters
commit https://github.com/vim/vim/commit/6daeef1933be68055aabe1d55f8467d46a707753
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Oct 15 22:56:49 2017 +0200
patch 8.0.1203: terminal window mistreats composing characters
Problem: Terminal window mistreats composing characters.
Solution: Count composing characters with the base character. (Ozaki Kiichi,
closes #2195)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 15 Oct 2017 23:00:04 +0200 |
parents | cdfd6eb8bb80 |
children | 17c257dd2438 |
comparison
equal
deleted
inserted
replaced
12649:2fca3bfff76f | 12650:f58755eb453e |
---|---|
683 call Stop_shell_in_terminal(buf) | 683 call Stop_shell_in_terminal(buf) |
684 call term_wait(buf) | 684 call term_wait(buf) |
685 exe buf . 'bwipe' | 685 exe buf . 'bwipe' |
686 unlet g:job | 686 unlet g:job |
687 endfunc | 687 endfunc |
688 | |
689 func Test_terminal_composing_unicode() | |
690 let save_enc = &encoding | |
691 set encoding=utf-8 | |
692 | |
693 if has('win32') | |
694 let cmd = "cmd /K chcp 65001" | |
695 let lnum = [3, 6, 9] | |
696 else | |
697 let cmd = &shell | |
698 let lnum = [1, 3, 5] | |
699 endif | |
700 | |
701 enew | |
702 let buf = term_start(cmd, {'curwin': bufnr('')}) | |
703 let job = term_getjob(buf) | |
704 call term_wait(buf, 50) | |
705 | |
706 " ascii + composing | |
707 let txt = "a\u0308bc" | |
708 call term_sendkeys(buf, "echo " . txt . "\r") | |
709 call term_wait(buf, 50) | |
710 call assert_match("echo " . txt, term_getline(buf, lnum[0])) | |
711 call assert_equal(txt, term_getline(buf, lnum[0] + 1)) | |
712 let l = term_scrape(buf, lnum[0] + 1) | |
713 call assert_equal("a\u0308", l[0].chars) | |
714 call assert_equal("b", l[1].chars) | |
715 call assert_equal("c", l[2].chars) | |
716 | |
717 " multibyte + composing | |
718 let txt = "\u304b\u3099\u304e\u304f\u3099\u3052\u3053\u3099" | |
719 call term_sendkeys(buf, "echo " . txt . "\r") | |
720 call term_wait(buf, 50) | |
721 call assert_match("echo " . txt, term_getline(buf, lnum[1])) | |
722 call assert_equal(txt, term_getline(buf, lnum[1] + 1)) | |
723 let l = term_scrape(buf, lnum[1] + 1) | |
724 call assert_equal("\u304b\u3099", l[0].chars) | |
725 call assert_equal("\u304e", l[1].chars) | |
726 call assert_equal("\u304f\u3099", l[2].chars) | |
727 call assert_equal("\u3052", l[3].chars) | |
728 call assert_equal("\u3053\u3099", l[4].chars) | |
729 | |
730 " \u00a0 + composing | |
731 let txt = "abc\u00a0\u0308" | |
732 call term_sendkeys(buf, "echo " . txt . "\r") | |
733 call term_wait(buf, 50) | |
734 call assert_match("echo " . txt, term_getline(buf, lnum[2])) | |
735 call assert_equal(txt, term_getline(buf, lnum[2] + 1)) | |
736 let l = term_scrape(buf, lnum[2] + 1) | |
737 call assert_equal("\u00a0\u0308", l[3].chars) | |
738 | |
739 call term_sendkeys(buf, "exit\r") | |
740 call WaitFor('job_status(job) == "dead"') | |
741 call assert_equal('dead', job_status(job)) | |
742 bwipe! | |
743 let &encoding = save_enc | |
744 endfunc |