emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r108624: Fix bug #11653 with cursor p


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108624: Fix bug #11653 with cursor positioning in a row that has only strings.
Date: Sat, 16 Jun 2012 12:57:56 +0300
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108624
fixes bug: http://debbugs.gnu.org/11653
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2012-06-16 12:57:56 +0300
message:
  Fix bug #11653 with cursor positioning in a row that has only strings.
  
   src/xdisp.c (set_cursor_from_row): Don't dereference glyphs_end.  If
   all the glyphs of the glyph row came from strings, and we have no
   cursor positioning clues, put the cursor on the first glyph of the
   row.
modified:
  src/ChangeLog
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-06-16 08:20:19 +0000
+++ b/src/ChangeLog     2012-06-16 09:57:56 +0000
@@ -1,3 +1,10 @@
+2012-06-16  Eli Zaretskii  <address@hidden>
+
+       * xdisp.c (set_cursor_from_row): Don't dereference glyphs_end.  If
+       all the glyphs of the glyph row came from strings, and we have no
+       cursor positioning clues, put the cursor on the first glyph of the
+       row.  (Bug#11653)
+
 2012-06-16  Andreas Schwab  <address@hidden>
 
        * category.h (CHAR_HAS_CATEGORY): Define as inline.

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2012-06-08 17:50:17 +0000
+++ b/src/xdisp.c       2012-06-16 09:57:56 +0000
@@ -14260,6 +14260,7 @@
             the cursor is not on this line.  */
          if (cursor == NULL
              && (row->reversed_p ? glyph <= end : glyph >= end)
+             && (row->reversed_p ? end > glyphs_end : end < glyphs_end)
              && STRINGP (end->object)
              && row->continued_p)
            return 0;
@@ -14289,6 +14290,21 @@
  compute_x:
   if (cursor != NULL)
     glyph = cursor;
+  else if (glyph == glyphs_end
+          && pos_before == pos_after
+          && STRINGP ((row->reversed_p
+                       ? row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1
+                       : row->glyphs[TEXT_AREA])->object))
+    {
+      /* If all the glyphs of this row came from strings, put the
+        cursor on the first glyph of the row.  This avoids having the
+        cursor outside of the text area in this very rare and hard
+        use case.  */
+      glyph =
+       row->reversed_p
+       ? row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1
+       : row->glyphs[TEXT_AREA];
+    }
   if (x < 0)
     {
       struct glyph *g;


reply via email to

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