emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r105567: Fix cursor motion with long


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105567: Fix cursor motion with long continued lines near window bottom.
Date: Thu, 25 Aug 2011 19:33:16 +0300
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105567
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Thu 2011-08-25 19:33:16 +0300
message:
  Fix cursor motion with long continued lines near window bottom.
  
   src/xdisp.c (try_cursor_movement): Check for the need to scroll more
   accurately, and prefer exact match for point under bidi.
modified:
  src/ChangeLog
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-08-25 10:45:33 +0000
+++ b/src/ChangeLog     2011-08-25 16:33:16 +0000
@@ -7,6 +7,8 @@
        (handle_single_display_spec): If the display spec is of the form
        `(space ...)', and specifies display in the text area, return 2
        rather than 1.
+       (try_cursor_movement): Check for the need to scroll more
+       accurately, and prefer exact match for point under bidi.
 
        * dispextern.h (struct bidi_it): Rename the disp_prop_p member
        into disp_prop; all users changed.

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2011-08-25 10:45:33 +0000
+++ b/src/xdisp.c       2011-08-25 16:33:16 +0000
@@ -14593,15 +14593,33 @@
 
              do
                {
+                 int at_zv_p = 0, exact_match_p = 0;
+
                  if (MATRIX_ROW_START_CHARPOS (row) <= PT
                      && PT <= MATRIX_ROW_END_CHARPOS (row)
                      && cursor_row_p (row))
                    rv |= set_cursor_from_row (w, row, w->current_matrix,
                                               0, 0, 0, 0);
-                 /* As soon as we've found the first suitable row
-                    whose ends_at_zv_p flag is set, we are done.  */
-                 if (rv
-                     && MATRIX_ROW (w->current_matrix, 
w->cursor.vpos)->ends_at_zv_p)
+                 /* As soon as we've found the exact match for point,
+                    or the first suitable row whose ends_at_zv_p flag
+                    is set, we are done.  */
+                 at_zv_p =
+                   MATRIX_ROW (w->current_matrix, 
w->cursor.vpos)->ends_at_zv_p;
+                 if (!at_zv_p)
+                   {
+                     struct glyph_row *candidate =
+                       MATRIX_ROW (w->current_matrix, w->cursor.vpos);
+                     struct glyph *g =
+                       candidate->glyphs[TEXT_AREA] + w->cursor.hpos;
+                     EMACS_INT endpos = MATRIX_ROW_END_CHARPOS (candidate);
+
+                     exact_match_p =
+                       (BUFFERP (g->object) && g->charpos == PT)
+                       || (INTEGERP (g->object)
+                           && (g->charpos == PT
+                               || (g->charpos == 0 && endpos - 1 == PT)));
+                   }
+                 if (rv && (at_zv_p || exact_match_p))
                    {
                      rc = CURSOR_MOVEMENT_SUCCESS;
                      break;
@@ -14617,7 +14635,9 @@
                 loop before all the candidates were examined, signal
                 to the caller that this method failed.  */
              if (rc != CURSOR_MOVEMENT_SUCCESS
-                 && (!rv || MATRIX_ROW_CONTINUATION_LINE_P (row)))
+                 && !(rv
+                      && !MATRIX_ROW_CONTINUATION_LINE_P (row)
+                      && !row->continued_p))
                rc = CURSOR_MOVEMENT_MUST_SCROLL;
              else if (rv)
                rc = CURSOR_MOVEMENT_SUCCESS;


reply via email to

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