Mercurial > vim
comparison src/terminal.c @ 12214:d2eea20ee14a v8.0.0987
patch 8.0.0987: terminal: second byte of double-byte char wrong
commit https://github.com/vim/vim/commit/d2c45a1964ddb0d9ac16c9c985051fab41f37840
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 22 22:29:00 2017 +0200
patch 8.0.0987: terminal: second byte of double-byte char wrong
Problem: terminal: second byte of double-byte char wrong
Solution: Set the second byte to NUL only for utf-8 and non-multibyte.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 22 Aug 2017 22:30:05 +0200 |
parents | 3ed8bcc9a013 |
children | 0ecfee22a2e2 |
comparison
equal
deleted
inserted
replaced
12213:dca6adb81733 | 12214:d2eea20ee14a |
---|---|
2128 | 2128 |
2129 if (WideCharToMultiByte(GetACP(), 0, &wc, 1, | 2129 if (WideCharToMultiByte(GetACP(), 0, &wc, 1, |
2130 (char*)mb, 2, 0, 0) > 1) | 2130 (char*)mb, 2, 0, 0) > 1) |
2131 { | 2131 { |
2132 ScreenLines[off] = mb[0]; | 2132 ScreenLines[off] = mb[0]; |
2133 ScreenLines[off+1] = mb[1]; | 2133 ScreenLines[off + 1] = mb[1]; |
2134 cell.width = mb_ptr2cells(mb); | 2134 cell.width = mb_ptr2cells(mb); |
2135 } | 2135 } |
2136 else | 2136 else |
2137 ScreenLines[off] = c; | 2137 ScreenLines[off] = c; |
2138 } | 2138 } |
2146 ++off; | 2146 ++off; |
2147 if (cell.width == 2) | 2147 if (cell.width == 2) |
2148 { | 2148 { |
2149 if (enc_utf8) | 2149 if (enc_utf8) |
2150 ScreenLinesUC[off] = NUL; | 2150 ScreenLinesUC[off] = NUL; |
2151 else if (!has_mbyte) | 2151 |
2152 /* don't set the second byte to NUL for a DBCS encoding, it | |
2153 * has been set above */ | |
2154 if (enc_utf8 || !has_mbyte) | |
2152 ScreenLines[off] = NUL; | 2155 ScreenLines[off] = NUL; |
2156 | |
2153 ++pos.col; | 2157 ++pos.col; |
2154 ++off; | 2158 ++off; |
2155 } | 2159 } |
2156 } | 2160 } |
2157 } | 2161 } |