changeset 107631:79cb7ef6ffda

Start working on cursor movement in continuation lines. xdisp.c (move_it_in_display_line_to): New variables prev_method and prev_pos. Compare for strict equality in
author Eli Zaretskii <eliz@gnu.org>
date Sat, 06 Feb 2010 12:47:35 -0500
parents 074a7ce7d59b
children a2c01839283b
files src/ChangeLog.bidi src/xdisp.c
diffstat 2 files changed, 23 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog.bidi	Fri Feb 05 09:28:04 2010 -0500
+++ b/src/ChangeLog.bidi	Sat Feb 06 12:47:35 2010 -0500
@@ -1,3 +1,10 @@
+2010-02-06  Eli Zaretskii  <eliz@gnu.org>
+
+	Start working on cursor movement in continuation lines.
+	* xdisp.c (move_it_in_display_line_to): New variables prev_method
+	and prev_pos.  Compare for strict equality in
+	BUFFER_POS_REACHED_P.
+
 2010-01-30  Eli Zaretskii  <eliz@gnu.org>
 
 	Fix fallout from changes to managing glyph row reversed_p flag.
--- a/src/xdisp.c	Fri Feb 05 09:28:04 2010 -0500
+++ b/src/xdisp.c	Sat Feb 06 12:47:35 2010 -0500
@@ -7009,6 +7009,8 @@
   struct glyph_row *saved_glyph_row;
   struct it wrap_it, atpos_it, atx_it;
   int may_wrap = 0;
+  enum it_method prev_method = it->method;
+  EMACS_INT prev_pos = IT_CHARPOS (*it);
 
   /* Don't produce glyphs in produce_glyphs.  */
   saved_glyph_row = it->glyph_row;
@@ -7026,7 +7028,7 @@
 #define BUFFER_POS_REACHED_P()					\
   ((op & MOVE_TO_POS) != 0					\
    && BUFFERP (it->object)					\
-   && IT_CHARPOS (*it) >= to_charpos				\
+   && IT_CHARPOS (*it) == to_charpos				\
    && (it->method == GET_FROM_BUFFER				\
        || (it->method == GET_FROM_DISPLAY_VECTOR		\
 	   && it->dpvec + it->current.dpvec_index + 1 >= it->dpend)))
@@ -7050,7 +7052,14 @@
       if ((op & MOVE_TO_POS) != 0
 	  && BUFFERP (it->object)
 	  && it->method == GET_FROM_BUFFER
-	  && IT_CHARPOS (*it) > to_charpos)
+	  && (prev_method == GET_FROM_IMAGE
+	      || prev_method == GET_FROM_STRETCH)
+	  /* Passed TO_CHARPOS from left to right.  */
+	  && ((prev_pos < to_charpos
+	       && IT_CHARPOS (*it) > to_charpos)
+	      /* Passed TO_CHARPOS from right to left.  */
+	      || (prev_pos > to_charpos)
+		  && IT_CHARPOS (*it) < to_charpos))
 	{
 	  if (it->line_wrap != WORD_WRAP || wrap_it.sp < 0)
 	    {
@@ -7064,6 +7073,9 @@
 	    atpos_it = *it;
 	}
 
+      prev_method = it->method;
+      if (it->method == GET_FROM_BUFFER)
+	prev_pos = IT_CHARPOS (*it);
       /* Stop when ZV reached.
          We used to stop here when TO_CHARPOS reached as well, but that is
          too soon if this glyph does not fit on this line.  So we handle it
@@ -7329,6 +7341,8 @@
 	  break;
 	}
 
+      if (it->method == GET_FROM_BUFFER)
+	prev_pos = IT_CHARPOS (*it);
       /* The current display element has been consumed.  Advance
 	 to the next.  */
       set_iterator_to_next (it, 1);