aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2011-08-24 18:51:56 +0300
committerEli Zaretskii2011-08-24 18:51:56 +0300
commit8610fe8b84e22f5d962f5e480001748a6687a3b2 (patch)
tree55985245e55238ddccc8d8994fb3a78a83cadba0 /src
parent5980d4c6db923da523fbb0e2fb44ecd68b13c53d (diff)
downloademacs-8610fe8b84e22f5d962f5e480001748a6687a3b2.tar.gz
emacs-8610fe8b84e22f5d962f5e480001748a6687a3b2.zip
Fix cursor movement in R2L text within L2R paragraphs.
src/xdisp.c (set_cursor_from_row): Consider candidate row a win if its glyph represents a newline and point is on that newline. Fixes cursor positioning on the newline at EOL of R2L text within L2R paragraph, and vice versa. (try_cursor_movement): Check continued rows, in addition to continuation rows. Fixes unwarranted scroll when point enters a continued line of R2L text within an L2R paragraph, or vice versa. (cursor_row_p): Consider the case of point being equal to MATRIX_ROW_END_CHARPOS. Prevents cursor being stuck when moving from the end of a short line to the beginning of a continued line of R2L text within L2R paragraph. (RECORD_MAX_MIN_POS): For max_pos, use IT_CHARPOS even for composed characters.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog13
-rw-r--r--src/xdisp.c21
2 files changed, 28 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d4d6a4c4bbd..b9c627bf160 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -2,6 +2,19 @@
2 2
3 * xdisp.c (Fcurrent_bidi_paragraph_direction): For unibyte 3 * xdisp.c (Fcurrent_bidi_paragraph_direction): For unibyte
4 buffers, return left-to-right. 4 buffers, return left-to-right.
5 (set_cursor_from_row): Consider candidate row a win if its glyph
6 represents a newline and point is on that newline. Fixes cursor
7 positioning on the newline at EOL of R2L text within L2R
8 paragraph, and vice versa.
9 (try_cursor_movement): Check continued rows, in addition to
10 continuation rows. Fixes unwarranted scroll when point enters a
11 continued line of R2L text within an L2R paragraph, or vice versa.
12 (cursor_row_p): Consider the case of point being equal to
13 MATRIX_ROW_END_CHARPOS. Prevents cursor being stuck when moving
14 from the end of a short line to the beginning of a continued line
15 of R2L text within L2R paragraph.
16 (RECORD_MAX_MIN_POS): For max_pos, use IT_CHARPOS even for
17 composed characters.
5 18
6 * bidi.c (bidi_check_type): Use xassert. 19 * bidi.c (bidi_check_type): Use xassert.
7 (bidi_cache_iterator_state): Update the disp_pos and disp_prop_p 20 (bidi_cache_iterator_state): Update the disp_pos and disp_prop_p
diff --git a/src/xdisp.c b/src/xdisp.c
index 8b3a71027b6..4ed08e72e19 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13796,7 +13796,14 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
13796 && glyph->charpos != pt_old))))) 13796 && glyph->charpos != pt_old)))))
13797 return 0; 13797 return 0;
13798 /* If this candidate gives an exact match, use that. */ 13798 /* If this candidate gives an exact match, use that. */
13799 if (!(BUFFERP (glyph->object) && glyph->charpos == pt_old) 13799 if (!((BUFFERP (glyph->object) && glyph->charpos == pt_old)
13800 /* If this candidate is a glyph created for the
13801 terminating newline of a line, and point is on that
13802 newline, it wins because it's an exact match. */
13803 || (!row->continued_p
13804 && INTEGERP (glyph->object)
13805 && glyph->charpos == 0
13806 && pt_old == MATRIX_ROW_END_CHARPOS (row) - 1))
13800 /* Otherwise, keep the candidate that comes from a row 13807 /* Otherwise, keep the candidate that comes from a row
13801 spanning less buffer positions. This may win when one or 13808 spanning less buffer positions. This may win when one or
13802 both candidate positions are on glyphs that came from 13809 both candidate positions are on glyphs that came from
@@ -14578,7 +14585,8 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
14578 } 14585 }
14579 ++row; 14586 ++row;
14580 } 14587 }
14581 while ((MATRIX_ROW_CONTINUATION_LINE_P (row) 14588 while (((MATRIX_ROW_CONTINUATION_LINE_P (row)
14589 || row->continued_p)
14582 && MATRIX_ROW_BOTTOM_Y (row) <= last_y) 14590 && MATRIX_ROW_BOTTOM_Y (row) <= last_y)
14583 || (MATRIX_ROW_START_CHARPOS (row) == PT 14591 || (MATRIX_ROW_START_CHARPOS (row) == PT
14584 && MATRIX_ROW_BOTTOM_Y (row) < last_y)); 14592 && MATRIX_ROW_BOTTOM_Y (row) < last_y));
@@ -18009,7 +18017,8 @@ cursor_row_p (struct glyph_row *row)
18009{ 18017{
18010 int result = 1; 18018 int result = 1;
18011 18019
18012 if (PT == CHARPOS (row->end.pos)) 18020 if (PT == CHARPOS (row->end.pos)
18021 || PT == MATRIX_ROW_END_CHARPOS (row))
18013 { 18022 {
18014 /* Suppose the row ends on a string. 18023 /* Suppose the row ends on a string.
18015 Unless the row is continued, that means it ends on a newline 18024 Unless the row is continued, that means it ends on a newline
@@ -18404,10 +18413,10 @@ display_line (struct it *it)
18404 min_pos = current_pos; \ 18413 min_pos = current_pos; \
18405 min_bpos = current_bpos; \ 18414 min_bpos = current_bpos; \
18406 } \ 18415 } \
18407 if (current_pos > max_pos) \ 18416 if (IT_CHARPOS (*it) > max_pos) \
18408 { \ 18417 { \
18409 max_pos = current_pos; \ 18418 max_pos = IT_CHARPOS (*it); \
18410 max_bpos = current_bpos; \ 18419 max_bpos = IT_BYTEPOS (*it); \
18411 } \ 18420 } \
18412 } \ 18421 } \
18413 while (0) 18422 while (0)