emacs-diffs
[Top][All Lists]
Advanced

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

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


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107628: Fix bug #11035 with cursor positioning on overlay strings with newlines.
Date: Sun, 18 Mar 2012 18:57:39 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107628
fixes bug(s): http://debbugs.gnu.org/11035
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sun 2012-03-18 18:57:39 +0200
message:
  Fix bug #11035 with cursor positioning on overlay strings with newlines.
  
   src/xdisp.c (cursor_row_p): Even if the glyph row ends in a string
   that is not from display property, accept the row as a "cursor
   row" if one of the string's character has a non-nil `cursor'
   property.  Fixes cursor positioning when there are newlines in
   overlay strings, e.g. in icomplete.el.
modified:
  src/ChangeLog
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-03-12 08:27:25 +0000
+++ b/src/ChangeLog     2012-03-18 16:57:39 +0000
@@ -1,3 +1,11 @@
+2012-03-18  Eli Zaretskii  <address@hidden>
+
+       * xdisp.c (cursor_row_p): Even if the glyph row ends in a string
+       that is not from display property, accept the row as a "cursor
+       row" if one of the string's character has a non-nil `cursor'
+       property.  Fixes cursor positioning when there are newlines in
+       overlay strings, e.g. in icomplete.el.  (Bug#11035)
+
 2012-03-12  Paul Eggert  <address@hidden>
 
        * buffer.c (compare_overlays): Don't assume args differ (Bug#6830).

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2012-03-02 15:40:44 +0000
+++ b/src/xdisp.c       2012-03-18 16:57:39 +0000
@@ -18456,9 +18456,11 @@
       /* Suppose the row ends on a string.
         Unless the row is continued, that means it ends on a newline
         in the string.  If it's anything other than a display string
-        (e.g. a before-string from an overlay), we don't want the
+        (e.g., a before-string from an overlay), we don't want the
         cursor there.  (This heuristic seems to give the optimal
-        behavior for the various types of multi-line strings.)  */
+        behavior for the various types of multi-line strings.)
+        One exception: if the string has `cursor' property on one of
+        its characters, we _do_ want the cursor there.  */
       if (CHARPOS (row->end.string_pos) >= 0)
        {
          if (row->continued_p)
@@ -18480,6 +18482,25 @@
                    result =
                      (!NILP (prop)
                       && display_prop_string_p (prop, glyph->object));
+                   /* If there's a `cursor' property on one of the
+                      string's characters, this row is a cursor row,
+                      even though this is not a display string.  */
+                   if (!result)
+                     {
+                       Lisp_Object s = glyph->object;
+
+                       for ( ; glyph >= beg && EQ (glyph->object, s); --glyph)
+                         {
+                           EMACS_INT gpos = glyph->charpos;
+
+                           if (!NILP (Fget_char_property (make_number (gpos),
+                                                          Qcursor, s)))
+                             {
+                               result = 1;
+                               break;
+                             }
+                         }
+                     }
                    break;
                  }
            }


reply via email to

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