]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix display of stretch glyphs
authorEli Zaretskii <eliz@gnu.org>
Fri, 17 Sep 2021 14:07:32 +0000 (17:07 +0300)
committerEli Zaretskii <eliz@gnu.org>
Fri, 17 Sep 2021 14:07:32 +0000 (17:07 +0300)
* src/xterm.c (x_draw_stretch_glyph_string):
* src/w32term.c (w32_draw_stretch_glyph_string): Fix drawing
stretch glyphs when the window is hscrolled.  (The original
pre-Jan-2021 code was almost correct, except that it used
'window_box_left_offset' instead of 'window_box_left', and didn't
restrict the background_width fixup to text-area.)  (Bug#50564)

src/w32term.c
src/xterm.c

index 70e5501db1d5294d4a333a154a09dfa5e7db36cb..9cf250cd73f7ac70510ad3ddff363d5823b6eaa5 100644 (file)
@@ -2423,29 +2423,15 @@ w32_draw_stretch_glyph_string (struct glyph_string *s)
   else if (!s->background_filled_p)
     {
       int background_width = s->background_width;
-      int x = s->x, text_left_x = window_box_left_offset (s->w, TEXT_AREA);
+      int x = s->x, text_left_x = window_box_left (s->w, TEXT_AREA);
 
       /* Don't draw into left fringe or scrollbar area except for
          header line and mode line.  */
-      if (x < text_left_x && !s->row->mode_line_p)
+      if (s->area == TEXT_AREA
+         && x < text_left_x && !s->row->mode_line_p)
        {
-         int left_x = WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (s->w);
-         int right_x = text_left_x;
-
-         if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w))
-           left_x += WINDOW_LEFT_FRINGE_WIDTH (s->w);
-         else
-           right_x -= WINDOW_LEFT_FRINGE_WIDTH (s->w);
-
-         /* Adjust X and BACKGROUND_WIDTH to fit inside the space
-            between LEFT_X and RIGHT_X.  */
-         if (x < left_x)
-           {
-             background_width -= left_x - x;
-             x = left_x;
-           }
-         if (x + background_width > right_x)
-           background_width = right_x - x;
+         background_width -= text_left_x - x;
+         x = text_left_x;
        }
       if (background_width > 0)
        w32_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height);
index 2c56c73068d80fb96a9ce74f4dcfe0c77d73765b..ae3af598da6f38ee4920a8fe6133017d79305b58 100644 (file)
@@ -3588,29 +3588,15 @@ x_draw_stretch_glyph_string (struct glyph_string *s)
   else if (!s->background_filled_p)
     {
       int background_width = s->background_width;
-      int x = s->x, text_left_x = window_box_left_offset (s->w, TEXT_AREA);
+      int x = s->x, text_left_x = window_box_left (s->w, TEXT_AREA);
 
       /* Don't draw into left fringe or scrollbar area except for
          header line and mode line.  */
-      if (x < text_left_x && !s->row->mode_line_p)
+      if (s->area == TEXT_AREA
+         && x < text_left_x && !s->row->mode_line_p)
        {
-         int left_x = WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (s->w);
-         int right_x = text_left_x;
-
-         if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w))
-           left_x += WINDOW_LEFT_FRINGE_WIDTH (s->w);
-         else
-           right_x -= WINDOW_LEFT_FRINGE_WIDTH (s->w);
-
-         /* Adjust X and BACKGROUND_WIDTH to fit inside the space
-            between LEFT_X and RIGHT_X.  */
-         if (x < left_x)
-           {
-             background_width -= left_x - x;
-             x = left_x;
-           }
-         if (x + background_width > right_x)
-           background_width = right_x - x;
+         background_width -= text_left_x - x;
+         x = text_left_x;
        }
       if (background_width > 0)
        x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height);