Mercurial > vim
diff src/terminal.c @ 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 | 94566ecb55f0 |
children | 17c257dd2438 |
line wrap: on
line diff
--- a/src/terminal.c +++ b/src/terminal.c @@ -40,12 +40,9 @@ * TODO: * - in GUI vertical split causes problems. Cursor is flickering. (Hirohito * Higashi, 2017 Sep 19) - * - patch to handle composing characters. (Ozaki Kiichi, #2195) * - double click in Window toolbar starts Visual mode (but not always?). * - Shift-Tab does not work. * - after resizing windows overlap. (Boris Staletic, #2164) - * - :wall gives an error message. (Marius Gedminas, #2190) - * patch suggested by Yasuhiro Matsumoto, Oct 10 * - Redirecting output does not work on MS-Windows, Test_terminal_redir_file() * is disabled. * - cursor blinks in terminal on widows with a timer. (xtal8, #2142) @@ -2299,7 +2296,6 @@ term_update_window(win_T *wp) if (vterm_screen_get_cell(screen, pos, &cell) == 0) vim_memset(&cell, 0, sizeof(cell)); - /* TODO: composing chars */ c = cell.chars[0]; if (c == NUL) { @@ -2311,7 +2307,18 @@ term_update_window(win_T *wp) { if (enc_utf8) { - if (c >= 0x80) + int i; + + /* composing chars */ + for (i = 0; i < Screen_mco + && i + 1 < VTERM_MAX_CHARS_PER_CELL; ++i) + { + ScreenLinesC[i][off] = cell.chars[i + 1]; + if (cell.chars[i + 1] == 0) + break; + } + if (c >= 0x80 || (Screen_mco > 0 + && ScreenLinesC[0][off] != 0)) { ScreenLines[off] = ' '; ScreenLinesUC[off] = c; @@ -3157,7 +3164,7 @@ f_term_sendkeys(typval_T *argvars, typva while (*msg != NUL) { send_keys_to_term(term, PTR2CHAR(msg), FALSE); - msg += MB_PTR2LEN(msg); + msg += MB_CPTR2LEN(msg); } }