]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix another part of bug #18035 with redisplay of line-prefix and linum-mode.
authorEli Zaretskii <eliz@gnu.org>
Mon, 28 Jul 2014 13:09:02 +0000 (16:09 +0300)
committerEli Zaretskii <eliz@gnu.org>
Mon, 28 Jul 2014 13:09:02 +0000 (16:09 +0300)
 src/xdisp.c (display_line): If called with iterator set up to write
 to a marginal area, delay the call to handle_line_prefix until we
 switch back to the text area.

src/ChangeLog
src/xdisp.c

index 619efb479e6ab7d6e1339c8b7dcb9013830a55be..090ed55bf924703ca3b94680eea22da5d2820947 100644 (file)
@@ -1,5 +1,9 @@
 2014-07-28  Eli Zaretskii  <eliz@gnu.org>
 
+       * xdisp.c (display_line): If called with iterator set up to write
+       to a marginal area, delay the call to handle_line_prefix until we
+       switch back to the text area.  (Bug#18035)
+
        * .gdbinit (xwindow): The members total_cols, total_lines,
        left_col, and top_line are C integers (and has been so for the
        last 1.5 years).
index d1016b6b8d7946645b9784e9da3694d837ff0e89..5cd90136ee62314313bb49b44b0bc0cef3514aa1 100644 (file)
@@ -19942,6 +19942,7 @@ display_line (struct it *it)
   int cvpos;
   ptrdiff_t min_pos = ZV + 1, max_pos = 0;
   ptrdiff_t min_bpos IF_LINT (= 0), max_bpos IF_LINT (= 0);
+  bool pending_handle_line_prefix = false;
 
   /* We always start displaying at hpos zero even if hscrolled.  */
   eassert (it->hpos == 0 && it->current_x == 0);
@@ -20002,13 +20003,23 @@ display_line (struct it *it)
       min_pos = CHARPOS (this_line_min_pos);
       min_bpos = BYTEPOS (this_line_min_pos);
     }
-  else
+  else if (it->area == TEXT_AREA)
     {
-      /* We only do this when not calling `move_it_in_display_line_to'
-        above, because move_it_in_display_line_to calls
-        handle_line_prefix itself.  */
+      /* We only do this when not calling move_it_in_display_line_to
+        above, because that function calls itself handle_line_prefix.  */
       handle_line_prefix (it);
     }
+  else
+    {
+      /* Line-prefix and wrap-prefix are always displayed in the text
+        area.  But if this is the first call to display_line after
+        init_iterator, the iterator might have been set up to write
+        into a marginal area, e.g. if the line begins with some
+        display property that writes to the margins.  So we need to
+        wait with the call to handle_line_prefix until whatever
+        writes to the margin has done its job.  */
+      pending_handle_line_prefix = true;
+    }
 
   /* Get the initial row height.  This is either the height of the
      text hscrolled, if there is any, or zero.  */
@@ -20140,6 +20151,14 @@ display_line (struct it *it)
          row->extra_line_spacing = max (row->extra_line_spacing,
                                         it->max_extra_line_spacing);
          set_iterator_to_next (it, 1);
+         /* If we didn't handle the line/wrap prefix above, and the
+            call to set_iterator_to_next just switched to TEXT_AREA,
+            process the prefix now.  */
+         if (it->area == TEXT_AREA && pending_handle_line_prefix)
+           {
+             pending_handle_line_prefix = false;
+             handle_line_prefix (it);
+           }
          continue;
        }