From: simon Date: Fri, 15 Oct 2004 09:28:46 +0000 (+0000) Subject: Fix applying combining characters to double-width characters. X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/f00630bedb5cab938783fa42fcb4c2efd45d97e9 Fix applying combining characters to double-width characters. git-svn-id: svn://svn.tartarus.org/sgt/putty@4628 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/terminal.c b/terminal.c index 708ffc8c..08574623 100644 --- a/terminal.c +++ b/terminal.c @@ -2717,8 +2717,26 @@ void term_out(Terminal *term) break; case 0: - add_cc(cline, term->curs.x - !term->wrapnext, c); - term->seen_disp_event = 1; + if (term->curs.x > 0) { + int x = term->curs.x - 1; + + /* If we're in wrapnext state, the character + * to combine with is _here_, not to our left. */ + if (term->wrapnext) + x++; + + /* + * If the previous character is + * UCSWIDE, back up another one. + */ + if (cline->chars[x].chr == UCSWIDE) { + assert(x > 0); + x--; + } + + add_cc(cline, x, c); + term->seen_disp_event = 1; + } continue; default: continue;