diff options
author | Chong Yidong <cyd@gnu.org> | 2012-09-21 11:03:48 +0800 |
---|---|---|
committer | Chong Yidong <cyd@gnu.org> | 2012-09-21 11:03:48 +0800 |
commit | acfa068f4a1a4652b784af1d7aaac92929399249 (patch) | |
tree | 4d5aef916164ae9862e4c94f50a5e53bbe274e53 /src/xdisp.c | |
parent | eb2deaffd17e760b3ec945c58d43080e8a44767a (diff) | |
parent | d3fa327c47570a1767324d23d710504e90b083f9 (diff) | |
download | emacs-acfa068f4a1a4652b784af1d7aaac92929399249.tar.gz |
Merge from emacs-24; up to 2012-05-07T14:57:18Z!michael.albinus@gmx.de
Diffstat (limited to 'src/xdisp.c')
-rw-r--r-- | src/xdisp.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 5ee5a46601c..f00719be37a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -7755,7 +7755,7 @@ compute_stop_pos_backwards (struct it *it) { it->end_charpos = min (charpos + 1, ZV); charpos = max (charpos - SCAN_BACK_LIMIT, BEGV); - SET_TEXT_POS (pos, charpos, BYTE_TO_CHAR (charpos)); + SET_TEXT_POS (pos, charpos, CHAR_TO_BYTE (charpos)); reseat_1 (it, pos, 0); compute_stop_pos (it); /* We must advance forward, right? */ @@ -16744,28 +16744,33 @@ try_window_reusing_current_matrix (struct window *w) } if (row < bottom_row) { - struct glyph *glyph = row->glyphs[TEXT_AREA] + w->cursor.hpos; - struct glyph *end = row->glyphs[TEXT_AREA] + row->used[TEXT_AREA]; - - /* Can't use this optimization with bidi-reordered glyph - rows, unless cursor is already at point. */ + /* Can't simply scan the row for point with + bidi-reordered glyph rows. Let set_cursor_from_row + figure out where to put the cursor, and if it fails, + give up. */ if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))) { - if (!(w->cursor.hpos >= 0 - && w->cursor.hpos < row->used[TEXT_AREA] - && BUFFERP (glyph->object) - && glyph->charpos == PT)) - return 0; + if (!set_cursor_from_row (w, row, w->current_matrix, + 0, 0, 0, 0)) + { + clear_glyph_matrix (w->desired_matrix); + return 0; + } } else - for (; glyph < end - && (!BUFFERP (glyph->object) - || glyph->charpos < PT); - glyph++) - { - w->cursor.hpos++; - w->cursor.x += glyph->pixel_width; - } + { + struct glyph *glyph = row->glyphs[TEXT_AREA] + w->cursor.hpos; + struct glyph *end = row->glyphs[TEXT_AREA] + row->used[TEXT_AREA]; + + for (; glyph < end + && (!BUFFERP (glyph->object) + || glyph->charpos < PT); + glyph++) + { + w->cursor.hpos++; + w->cursor.x += glyph->pixel_width; + } + } } } |