]> git.eshelyaron.com Git - emacs.git/commitdiff
A cleaner fix for display bug#52947
authorEli Zaretskii <eliz@gnu.org>
Tue, 4 Jan 2022 13:37:16 +0000 (15:37 +0200)
committerEli Zaretskii <eliz@gnu.org>
Tue, 4 Jan 2022 13:37:16 +0000 (15:37 +0200)
* src/xdisp.c (tab_bar_height, redisplay_tab_bar): Don't call
set_iterator_to_next here...
(display_tab_bar_line): ...call it here, even if we exit the loop
because we encounter a newline.

src/xdisp.c

index 6e94ff5ec6849247584f6f8738b63fbd674350e9..0635cad0d19aa4371654186594bcf62013b99df1 100644 (file)
@@ -13745,6 +13745,7 @@ display_tab_bar_line (struct it *it, int height)
      so there's no need to check the face here.  */
   it->start_of_box_run_p = true;
 
+  bool enough = false;
   while (it->current_x < max_x)
     {
       int x, n_glyphs_before, i, nglyphs;
@@ -13791,11 +13792,12 @@ display_tab_bar_line (struct it *it, int height)
          ++i;
        }
 
+      enough = ITERATOR_AT_END_OF_LINE_P (it);
+      set_iterator_to_next (it, true);
+
       /* Stop at line end.  */
-      if (ITERATOR_AT_END_OF_LINE_P (it))
+      if (enough)
        break;
-
-      set_iterator_to_next (it, true);
     }
 
  out:;
@@ -13878,10 +13880,6 @@ tab_bar_height (struct frame *f, int *n_rows, bool pixelwise)
     {
       it.glyph_row = temp_row;
       display_tab_bar_line (&it, -1);
-      /* If the tab-bar string includes newlines, get past it, because
-        display_tab_bar_line doesn't.  */
-      if (ITERATOR_AT_END_OF_LINE_P (&it))
-       set_iterator_to_next (&it, true);
     }
   clear_glyph_row (temp_row);
 
@@ -14007,10 +14005,6 @@ redisplay_tab_bar (struct frame *f)
              extra -= h;
            }
          display_tab_bar_line (&it, height + h);
-         /* If the tab-bar string includes newlines, get past it,
-            because display_tab_bar_line doesn't.  */
-         if (ITERATOR_AT_END_OF_LINE_P (&it))
-           set_iterator_to_next (&it, true);
        }
     }
   else