Mercurial > vim
diff src/libvterm/src/termscreen.c @ 18064:8b4f9be5db73 v8.1.2027
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Commit: https://github.com/vim/vim/commit/57da69816872d53038e8a7e8dd4dc39a31192f0d
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Sep 13 22:30:11 2019 +0200
patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Problem: MS-Windows: problem with ambiwidth characters.
Solution: handle ambiguous width characters in ConPTY on Windows 10 (1903).
(Nobuhiro Takasaki, closes #4411)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 13 Sep 2019 22:45:04 +0200 |
parents | 811a12a78164 |
children | 9c3347b21b89 |
line wrap: on
line diff
--- a/src/libvterm/src/termscreen.c +++ b/src/libvterm/src/termscreen.c @@ -770,11 +770,28 @@ int vterm_screen_get_cell(const VTermScr cell->fg = intcell->pen.fg; cell->bg = intcell->pen.bg; - if(pos.col < (screen->cols - 1) && - getcell(screen, pos.row, pos.col + 1)->chars[0] == (uint32_t)-1) - cell->width = 2; - else - cell->width = 1; + if(vterm_get_special_pty_type() == 2) { + /* Get correct cell width from cell information contained in line buffer */ + if(pos.col < (screen->cols - 1) && + getcell(screen, pos.row, pos.col + 1)->chars[0] == (uint32_t)-1) { + if(getcell(screen, pos.row, pos.col)->chars[0] == 0x20) { + getcell(screen, pos.row, pos.col)->chars[0] = 0; + cell->width = 2; + } else if(getcell(screen, pos.row, pos.col)->chars[0] == 0) { + getcell(screen, pos.row, pos.col + 1)->chars[0] = 0; + cell->width = 1; + } else { + cell->width = 2; + } + } else + cell->width = 1; + } else { + if(pos.col < (screen->cols - 1) && + getcell(screen, pos.row, pos.col + 1)->chars[0] == (uint32_t)-1) + cell->width = 2; + else + cell->width = 1; + } return 1; }