emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r105554: Fix cursor movement in R2L t


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105554: Fix cursor movement in R2L text within L2R paragraphs.
Date: Wed, 24 Aug 2011 18:51:56 +0300
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105554
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Wed 2011-08-24 18:51:56 +0300
message:
  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.
modified:
  src/ChangeLog
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-08-24 11:49:54 +0000
+++ b/src/ChangeLog     2011-08-24 15:51:56 +0000
@@ -2,6 +2,19 @@
 
        * xdisp.c (Fcurrent_bidi_paragraph_direction): For unibyte
        buffers, return left-to-right.
+       (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.
 
        * bidi.c (bidi_check_type): Use xassert.
        (bidi_cache_iterator_state): Update the disp_pos and disp_prop_p

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2011-08-24 11:49:54 +0000
+++ b/src/xdisp.c       2011-08-24 15:51:56 +0000
@@ -13796,7 +13796,14 @@
                          && glyph->charpos != pt_old)))))
        return 0;
       /* If this candidate gives an exact match, use that.  */
-      if (!(BUFFERP (glyph->object) && glyph->charpos == pt_old)
+      if (!((BUFFERP (glyph->object) && glyph->charpos == pt_old)
+           /* If this candidate is a glyph created for the
+              terminating newline of a line, and point is on that
+              newline, it wins because it's an exact match.  */
+           || (!row->continued_p
+               && INTEGERP (glyph->object)
+               && glyph->charpos == 0
+               && pt_old == MATRIX_ROW_END_CHARPOS (row) - 1))
          /* Otherwise, keep the candidate that comes from a row
             spanning less buffer positions.  This may win when one or
             both candidate positions are on glyphs that came from
@@ -14578,7 +14585,8 @@
                    }
                  ++row;
                }
-             while ((MATRIX_ROW_CONTINUATION_LINE_P (row)
+             while (((MATRIX_ROW_CONTINUATION_LINE_P (row)
+                      || row->continued_p)
                      && MATRIX_ROW_BOTTOM_Y (row) <= last_y)
                     || (MATRIX_ROW_START_CHARPOS (row) == PT
                         && MATRIX_ROW_BOTTOM_Y (row) < last_y));
@@ -18009,7 +18017,8 @@
 {
   int result = 1;
 
-  if (PT == CHARPOS (row->end.pos))
+  if (PT == CHARPOS (row->end.pos)
+      || PT == MATRIX_ROW_END_CHARPOS (row))
     {
       /* Suppose the row ends on a string.
         Unless the row is continued, that means it ends on a newline
@@ -18404,10 +18413,10 @@
          min_pos = current_pos;                                \
          min_bpos = current_bpos;                              \
        }                                                       \
-      if (current_pos > max_pos)                               \
+      if (IT_CHARPOS (*it) > max_pos)                          \
        {                                                       \
-         max_pos = current_pos;                                \
-         max_bpos = current_bpos;                              \
+         max_pos = IT_CHARPOS (*it);                           \
+         max_bpos = IT_BYTEPOS (*it);                          \
        }                                                       \
     }                                                          \
   while (0)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]