mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Fix crash printing a width-2 char in a width-1 terminal.
If the terminal is one column wide, it's not possible to print a double-width CJK character at all - it won't fit. Replace it with U+FFFD to indicate that impossibility. The previous behaviour was to notice that we're in the rightmost column of the terminal, and invoke the LATTR_WRAPPED2 special case to wrap to the leftmost column on the next line. But in a width-1 terminal, the rightmost column _is_ the leftmost column, so this would leave us no better off, and we would have fallen through into the next case while in exactly the situation we'd tried to rule out.
This commit is contained in:
parent
daf91ef8ae
commit
03777723e5
10
terminal.c
10
terminal.c
@ -2771,6 +2771,16 @@ static void term_display_graphic_char(Terminal *term, unsigned long c)
|
||||
(c & CSET_MASK) == 0) && term->logctx)
|
||||
logtraffic(term->logctx, (unsigned char) c, LGTYP_ASCII);
|
||||
|
||||
/*
|
||||
* Preliminary check: if the terminal is only one character cell
|
||||
* wide, then we cannot display any double-width character at all.
|
||||
* Substitute single-width REPLACEMENT CHARACTER instead.
|
||||
*/
|
||||
if (width == 2 && term->cols < 2) {
|
||||
width = 1;
|
||||
c = 0xFFFD;
|
||||
}
|
||||
|
||||
switch (width) {
|
||||
case 2:
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user