From 97c9858753082f553e59c294fcc1d5fffa61ffa2 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Fri, 8 Aug 2008 15:43:45 +0000 Subject: [PATCH] (move_it_to): When stopping at a charpos, check if that's a continued multi-char glyph; if so, advance to the actual glyph. --- src/ChangeLog | 6 ++++++ src/xdisp.c | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 4544bf0b841..af871f2ce62 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2008-08-08 Chong Yidong + + * xdisp.c (move_it_to): When stopping at a charpos, check if + that's a continued multi-char glyph; if so, advance to the actual + glyph. + 2008-08-07 Dan Nicolaescu * s/darwin.h (OTHER_FILES): Do not define here, defined in diff --git a/src/xdisp.c b/src/xdisp.c index 920e7c1d34e..2f809e3a096 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -7296,6 +7296,30 @@ move_it_to (it, to_charpos, to_x, to_y, to_vpos, op) out: + /* On text terminals, we may stop at the end of a line in the middle + of a multi-character glyph. If the glyph itself is continued, + i.e. it is actually displayed on the next line, don't treat this + stopping point as valid; move to the next line instead (unless + that brings us offscreen). */ + if (!FRAME_WINDOW_P (it->f) + && op & MOVE_TO_POS + && IT_CHARPOS (*it) == to_charpos + && it->what == IT_CHARACTER + && it->nglyphs > 1 + && it->line_wrap == WINDOW_WRAP + && it->current_x == it->last_visible_x - 1 + && it->c != '\n' + && it->c != '\t' + && it->vpos < XFASTINT (it->w->window_end_vpos)) + { + it->continuation_lines_width += it->current_x; + it->current_x = it->hpos = it->max_ascent = it->max_descent = 0; + it->current_y += it->max_ascent + it->max_descent; + ++it->vpos; + last_height = it->max_ascent + it->max_descent; + last_max_ascent = it->max_ascent; + } + TRACE_MOVE ((stderr, "move_it_to: reached %d\n", reached)); } -- 2.39.2