emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r112520: Fix vertical cursor motion w


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112520: Fix vertical cursor motion when there's a display string with newline at EOL.
Date: Wed, 08 May 2013 20:59:38 +0300
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 112520
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Wed 2013-05-08 20:59:38 +0300
message:
  Fix vertical cursor motion when there's a display string with newline at EOL.
  
   src/xdisp.c (row_for_charpos_p): New function, with code of
   cursor_row_p, but accepts an additional argument CHARPOS instead
   of using a hardcoded PT.
   (cursor_row_p): Call row_for_charpos_p with 2nd argument PT.
   (row_containing_pos): Call row_for_charpos_p instead of partially
   doing the same.  Fixes cursor positioning under longlines-mode
   when longlines-show-effect includes more than one newline, when
   moving the cursor vertically up.
modified:
  src/ChangeLog
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-05-08 16:21:19 +0000
+++ b/src/ChangeLog     2013-05-08 17:59:38 +0000
@@ -1,3 +1,14 @@
+2013-05-08  Eli Zaretskii  <address@hidden>
+
+       * xdisp.c (row_for_charpos_p): New function, with code of
+       cursor_row_p, but accepts an additional argument CHARPOS instead
+       of using a hardcoded PT.
+       (cursor_row_p): Call row_for_charpos_p with 2nd argument PT.
+       (row_containing_pos): Call row_for_charpos_p instead of partially
+       doing the same.  Fixes cursor positioning under longlines-mode
+       when longlines-show-effect includes more than one newline, when
+       moving the cursor vertically up.
+
 2013-05-08  Juanma Barranquero  <address@hidden>
 
        * makefile.w32-in (ACL_H): New macro.

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2013-05-06 17:11:07 +0000
+++ b/src/xdisp.c       2013-05-08 17:59:38 +0000
@@ -794,6 +794,7 @@
 static void mark_window_display_accurate_1 (struct window *, int);
 static int single_display_spec_string_p (Lisp_Object, Lisp_Object);
 static int display_prop_string_p (Lisp_Object, Lisp_Object);
+static int row_for_charpos_p (struct glyph_row *, ptrdiff_t);
 static int cursor_row_p (struct glyph_row *);
 static int redisplay_mode_lines (Lisp_Object, int);
 static char *decode_mode_spec_coding (Lisp_Object, char *, int);
@@ -16909,10 +16910,9 @@
             || (MATRIX_ROW_END_CHARPOS (row) == charpos
                 /* The end position of a row equals the start
                    position of the next row.  If CHARPOS is there, we
-                   would rather display it in the next line, except
-                   when this line ends in ZV.  */
-                && !row->ends_at_zv_p
-                && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)))
+                   would rather consider it displayed in the next
+                   line, except when this line ends in ZV.  */
+                && !row_for_charpos_p (row, charpos)))
          && charpos >= MATRIX_ROW_START_CHARPOS (row))
        {
          struct glyph *g;
@@ -16920,10 +16920,10 @@
          if (NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering))
              || (!best_row && !row->continued_p))
            return row;
-         /* In bidi-reordered rows, there could be several rows
-            occluding point, all of them belonging to the same
-            continued line.  We need to find the row which fits
-            CHARPOS the best.  */
+         /* In bidi-reordered rows, there could be several rows whose
+            edges surround CHARPOS, all of these rows belonging to
+            the same continued line.  We need to find the row which
+            fits CHARPOS the best.  */
          for (g = row->glyphs[TEXT_AREA];
               g < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA];
               g++)
@@ -18727,15 +18727,15 @@
 
 
 /* Value is non-zero if glyph row ROW should be
-   used to hold the cursor.  */
+   considered to hold the buffer position CHARPOS.  */
 
 static int
-cursor_row_p (struct glyph_row *row)
+row_for_charpos_p (struct glyph_row *row, ptrdiff_t charpos)
 {
   int result = 1;
 
-  if (PT == CHARPOS (row->end.pos)
-      || PT == MATRIX_ROW_END_CHARPOS (row))
+  if (charpos == CHARPOS (row->end.pos)
+      || charpos == MATRIX_ROW_END_CHARPOS (row))
     {
       /* Suppose the row ends on a string.
         Unless the row is continued, that means it ends on a newline
@@ -18761,7 +18761,7 @@
                if (STRINGP (glyph->object))
                  {
                    Lisp_Object prop
-                     = Fget_char_property (make_number (PT),
+                     = Fget_char_property (make_number (charpos),
                                            Qdisplay, Qnil);
                    result =
                      (!NILP (prop)
@@ -18815,6 +18815,15 @@
   return result;
 }
 
+/* Value is non-zero if glyph row ROW should be
+   used to hold the cursor.  */
+
+static int
+cursor_row_p (struct glyph_row *row)
+{
+  return row_for_charpos_p (row, PT);
+}
+
 
 
 /* Push the property PROP so that it will be rendered at the current


reply via email to

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