aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2021-01-27 17:52:51 +0200
committerEli Zaretskii2021-01-27 17:52:51 +0200
commitff0341126918e36777d1b85a3661577442b574cb (patch)
tree4374511042f0efc9a1305ef252830011ec22a625 /src
parent12095de8b918b3c44c603bf88bc98f1842910f86 (diff)
downloademacs-ff0341126918e36777d1b85a3661577442b574cb.tar.gz
emacs-ff0341126918e36777d1b85a3661577442b574cb.zip
Fix display of stretches of whitespace in the display margins
* src/xdisp.c (produce_stretch_glyph): Truncate the stretch glyph due to line wrap only when drawing in the text area. * src/xterm.c (x_draw_stretch_glyph_string): * src/w32term.c (w32_draw_stretch_glyph_string): Fix the adjustment of the stretch X and width so that stretch glyphs could be drawn in the left margin. Reported by Paul W. Rankin <pwr@bydasein.com>.
Diffstat (limited to 'src')
-rw-r--r--src/w32term.c27
-rw-r--r--src/xdisp.c3
-rw-r--r--src/xterm.c27
3 files changed, 44 insertions, 13 deletions
diff --git a/src/w32term.c b/src/w32term.c
index 109aa58d732..0ee805a8526 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -2404,14 +2404,29 @@ w32_draw_stretch_glyph_string (struct glyph_string *s)
2404 else if (!s->background_filled_p) 2404 else if (!s->background_filled_p)
2405 { 2405 {
2406 int background_width = s->background_width; 2406 int background_width = s->background_width;
2407 int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); 2407 int x = s->x, text_left_x = window_box_left_offset (s->w, TEXT_AREA);
2408 2408
2409 /* Don't draw into left margin, fringe or scrollbar area 2409 /* Don't draw into left fringe or scrollbar area except for
2410 except for header line and mode line. */ 2410 header line and mode line. */
2411 if (x < left_x && !s->row->mode_line_p) 2411 if (x < text_left_x && !s->row->mode_line_p)
2412 { 2412 {
2413 background_width -= left_x - x; 2413 int left_x = WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (s->w);
2414 x = left_x; 2414 int right_x = text_left_x;
2415
2416 if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w))
2417 left_x += WINDOW_LEFT_FRINGE_WIDTH (s->w);
2418 else
2419 right_x -= WINDOW_LEFT_FRINGE_WIDTH (s->w);
2420
2421 /* Adjust X and BACKGROUND_WIDTH to fit inside the space
2422 between LEFT_X and RIGHT_X. */
2423 if (x < left_x)
2424 {
2425 background_width -= left_x - x;
2426 x = left_x;
2427 }
2428 if (x + background_width > right_x)
2429 background_width = right_x - x;
2415 } 2430 }
2416 if (background_width > 0) 2431 if (background_width > 0)
2417 w32_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height); 2432 w32_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height);
diff --git a/src/xdisp.c b/src/xdisp.c
index e1e4ff41365..11b9e1becfd 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -29813,7 +29813,8 @@ produce_stretch_glyph (struct it *it)
29813#endif /* HAVE_WINDOW_SYSTEM */ 29813#endif /* HAVE_WINDOW_SYSTEM */
29814 height = 1; 29814 height = 1;
29815 29815
29816 if (width > 0 && it->line_wrap != TRUNCATE 29816 if (width > 0
29817 && it->area == TEXT_AREA && it->line_wrap != TRUNCATE
29817 && it->current_x + width > it->last_visible_x) 29818 && it->current_x + width > it->last_visible_x)
29818 { 29819 {
29819 width = it->last_visible_x - it->current_x; 29820 width = it->last_visible_x - it->current_x;
diff --git a/src/xterm.c b/src/xterm.c
index a855d2d67aa..744b80c68a0 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -3585,14 +3585,29 @@ x_draw_stretch_glyph_string (struct glyph_string *s)
3585 else if (!s->background_filled_p) 3585 else if (!s->background_filled_p)
3586 { 3586 {
3587 int background_width = s->background_width; 3587 int background_width = s->background_width;
3588 int x = s->x, left_x = window_box_left_offset (s->w, TEXT_AREA); 3588 int x = s->x, text_left_x = window_box_left_offset (s->w, TEXT_AREA);
3589 3589
3590 /* Don't draw into left margin, fringe or scrollbar area 3590 /* Don't draw into left fringe or scrollbar area except for
3591 except for header line and mode line. */ 3591 header line and mode line. */
3592 if (x < left_x && !s->row->mode_line_p) 3592 if (x < text_left_x && !s->row->mode_line_p)
3593 { 3593 {
3594 background_width -= left_x - x; 3594 int left_x = WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (s->w);
3595 x = left_x; 3595 int right_x = text_left_x;
3596
3597 if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w))
3598 left_x += WINDOW_LEFT_FRINGE_WIDTH (s->w);
3599 else
3600 right_x -= WINDOW_LEFT_FRINGE_WIDTH (s->w);
3601
3602 /* Adjust X and BACKGROUND_WIDTH to fit inside the space
3603 between LEFT_X and RIGHT_X. */
3604 if (x < left_x)
3605 {
3606 background_width -= left_x - x;
3607 x = left_x;
3608 }
3609 if (x + background_width > right_x)
3610 background_width = right_x - x;
3596 } 3611 }
3597 if (background_width > 0) 3612 if (background_width > 0)
3598 x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height); 3613 x_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height);