emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r105594: Fix vertical cursor motion f


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105594: Fix vertical cursor motion from start of R2L lines in L2R paragraphs.
Date: Sat, 27 Aug 2011 21:11:49 +0300
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105594
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2011-08-27 21:11:49 +0300
message:
  Fix vertical cursor motion from start of R2L lines in L2R paragraphs.
  
   src/xdisp.c (move_it_to): Don't bail out early when reaching
   position beyond to_charpos, if we are scanning backwards.
   (move_it_vertically_backward): When DY == 0, make sure we get to
   the first character in the line after the newline.
modified:
  src/ChangeLog
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-08-27 07:07:32 +0000
+++ b/src/ChangeLog     2011-08-27 18:11:49 +0000
@@ -1,3 +1,10 @@
+2011-08-27  Eli Zaretskii  <address@hidden>
+
+       * xdisp.c (move_it_to): Don't bail out early when reaching
+       position beyond to_charpos, if we are scanning backwards.
+       (move_it_vertically_backward): When DY == 0, make sure we get to
+       the first character in the line after the newline.
+
 2011-08-27  Paul Eggert  <address@hidden>
 
        * ccl.c: Improve and simplify overflow checking (Bug#9196).

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2011-08-26 16:13:07 +0000
+++ b/src/xdisp.c       2011-08-27 18:11:49 +0000
@@ -8360,7 +8360,14 @@
       else if (BUFFERP (it->object)
               && (it->method == GET_FROM_BUFFER
                   || it->method == GET_FROM_STRETCH)
-              && IT_CHARPOS (*it) >= to_charpos)
+              && IT_CHARPOS (*it) >= to_charpos
+              /* Under bidi iteration, a call to set_iterator_to_next
+                 can scan far beyond to_charpos if the initial
+                 portion of the next line needs to be reordered.  In
+                 that case, give move_it_in_display_line_to another
+                 chance below.  */
+              && !(it->bidi_p
+                   && it->bidi_it.scan_dir == -1))
        skip = MOVE_POS_MATCH_OR_ZV;
       else
        skip = move_it_in_display_line_to (it, to_charpos, -1, MOVE_TO_POS);
@@ -8495,7 +8502,8 @@
   reseat_1 (it, it->current.pos, 1);
 
   /* We are now surely at a line start.  */
-  it->current_x = it->hpos = 0;
+  it->current_x = it->hpos = 0;        /* FIXME: this is incorrect when bidi
+                                  reordering is in effect.  */
   it->continuation_lines_width = 0;
 
   /* Move forward and see what y-distance we moved.  First move to the
@@ -8529,10 +8537,25 @@
   if (dy == 0)
     {
       /* DY == 0 means move to the start of the screen line.  The
-        value of nlines is > 0 if continuation lines were involved.  */
+        value of nlines is > 0 if continuation lines were involved,
+        or if the original IT position was at start of a line.  */
       RESTORE_IT (it, it, it2data);
       if (nlines > 0)
        move_it_by_lines (it, nlines);
+      /* The above code moves us to some position NLINES down,
+        usually to its first glyph (leftmost in an L2R line), but
+        that's not necessarily the start of the line, under bidi
+        reordering.  We want to get to the character position
+        that is immediately after the newline of the previous
+        line.  */
+      if (it->bidi_p && IT_CHARPOS (*it) > BEGV
+         && FETCH_BYTE (IT_BYTEPOS (*it) - 1) != '\n')
+       {
+         EMACS_INT nl_pos =
+           find_next_newline_no_quit (IT_CHARPOS (*it) - 1, -1);
+
+         move_it_to (it, nl_pos, -1, -1, -1, MOVE_TO_POS);
+       }
       bidi_unshelve_cache (it3data, 1);
     }
   else


reply via email to

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