1
0
forked from aniani/vim

patch 9.0.1598: screenchar() and others are wrong with DBCS 'encoding'

Problem:    screenchar(), screenchars() and screenstring() do not work
            properly when 'encoding' is set to a double-byte encoding.
Solution:   Fix the way the bytes of the characters are obtained.
            (issue #12469)
This commit is contained in:
zeertzjq
2023-06-01 20:26:55 +01:00
committed by Bram Moolenaar
parent 8509014add
commit 47eec6716b
5 changed files with 58 additions and 35 deletions

View File

@@ -1199,8 +1199,9 @@ screen_putchar(int c, int row, int col, int attr)
}
/*
* Get a single character directly from ScreenLines into "bytes[]".
* Also return its attribute in *attrp;
* Get a single character directly from ScreenLines into "bytes", which must
* have a size of "MB_MAXBYTES + 1".
* If "attrp" is not NULL, return the character's attribute in "*attrp".
*/
void
screen_getbytes(int row, int col, char_u *bytes, int *attrp)
@@ -1212,7 +1213,8 @@ screen_getbytes(int row, int col, char_u *bytes, int *attrp)
return;
off = LineOffset[row] + col;
*attrp = ScreenAttrs[off];
if (attrp != NULL)
*attrp = ScreenAttrs[off];
bytes[0] = ScreenLines[off];
bytes[1] = NUL;