aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1996-09-21 01:16:33 +0000
committerRichard M. Stallman1996-09-21 01:16:33 +0000
commit73f194f117b0ed1ef809b6c29332a9df9899c1c5 (patch)
treee155acde2d5c2b8012299083fceb32551339a158 /src
parent1ab3d87e2fa3e5f0258d94feeb75ce2bbc9f619a (diff)
downloademacs-73f194f117b0ed1ef809b6c29332a9df9899c1c5.tar.gz
emacs-73f194f117b0ed1ef809b6c29332a9df9899c1c5.zip
(display_mode_line): Use faces for inverse video mode line whenever possible.
(echo_area_display): Shift display_string past a left-side scroll bar. (redisplay_window): Likewise. (redisplay_internal): Shift cursor past a left-side scroll bar. (redisplay_window): Likewise. (try_window_id): Likewise. (display_text_line): Likewise. (redisplay_internal): Shift charstarts past a left-side scroll bar. (display_text_line): Likewise. (redisplay_internal): Use new macro WINDOW_FULL_WIDTH_P. (redisplay_window): Likewise. (display_text_line): Likewise. (display_text_line): Shift output past left-side scroll bar. (display_text_line): Use new WINDOW_RIGHTMOST_P macro. (display_text_line): Don't pad right columns unless using a right-side scroll bar. Don't draw vertical bars unless there isn't any kind of scroll bar. (display_string): Likewise. (display_mode_line): Use new macros WINDOW_LEFT_MARGIN, WINDOW_RIGHT_MARGIN, and WINDOW_FULL_WIDTH_P. (display_string): Use new macro WINDOW_RIGHTMOST_P.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c91
1 files changed, 50 insertions, 41 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 48f575cb222..868113434f5 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -603,7 +603,8 @@ echo_area_display ()
603 display_string (XWINDOW (mini_window), vpos, 603 display_string (XWINDOW (mini_window), vpos,
604 echo_area_glyphs ? echo_area_glyphs : "", 604 echo_area_glyphs ? echo_area_glyphs : "",
605 echo_area_glyphs ? echo_area_glyphs_length : -1, 605 echo_area_glyphs ? echo_area_glyphs_length : -1,
606 0, 0, 0, 0, FRAME_WIDTH (f)); 606 FRAME_LEFT_SCROLL_BAR_WIDTH (f),
607 0, 0, 0, FRAME_WIDTH (f));
607 608
608#if 0 /* This just gets in the way. update_frame does the job. */ 609#if 0 /* This just gets in the way. update_frame does the job. */
609 /* If desired cursor location is on this line, put it at end of text */ 610 /* If desired cursor location is on this line, put it at end of text */
@@ -622,7 +623,9 @@ echo_area_display ()
622 { 623 {
623 get_display_line (f, i, 0); 624 get_display_line (f, i, 0);
624 display_string (XWINDOW (mini_window), vpos, 625 display_string (XWINDOW (mini_window), vpos,
625 "", 0, 0, 0, 0, 0, FRAME_WIDTH (f)); 626 "", 0,
627 FRAME_LEFT_SCROLL_BAR_WIDTH (f),
628 0, 0, 0, FRAME_WIDTH (f));
626 } 629 }
627 } 630 }
628 } 631 }
@@ -987,7 +990,7 @@ redisplay_internal (preserve_echo_area)
987 if (this_line_vpos + 1 990 if (this_line_vpos + 1
988 < XFASTINT (w->top) + window_internal_height (w)) 991 < XFASTINT (w->top) + window_internal_height (w))
989 { 992 {
990 int left = XFASTINT (w->left); 993 int left = WINDOW_LEFT_MARGIN (w);
991 int *charstart_next_line 994 int *charstart_next_line
992 = FRAME_CURRENT_GLYPHS (XFRAME (WINDOW_FRAME (w)))->charstarts[this_line_vpos + 1]; 995 = FRAME_CURRENT_GLYPHS (XFRAME (WINDOW_FRAME (w)))->charstarts[this_line_vpos + 1];
993 int adjust; 996 int adjust;
@@ -1005,7 +1008,7 @@ redisplay_internal (preserve_echo_area)
1005 adjust_window_charstarts (w, this_line_vpos, adjust); 1008 adjust_window_charstarts (w, this_line_vpos, adjust);
1006 } 1009 }
1007 1010
1008 if (XFASTINT (w->width) != FRAME_WIDTH (XFRAME (WINDOW_FRAME (w)))) 1011 if (!WINDOW_FULL_WIDTH_P (w))
1009 preserve_other_columns (w); 1012 preserve_other_columns (w);
1010 goto update; 1013 goto update;
1011 } 1014 }
@@ -1045,7 +1048,7 @@ redisplay_internal (preserve_echo_area)
1045 { 1048 {
1046 int width = window_internal_width (w) - 1; 1049 int width = window_internal_width (w) - 1;
1047 FRAME_CURSOR_X (selected_frame) 1050 FRAME_CURSOR_X (selected_frame)
1048 = XFASTINT (w->left) + minmax (0, pos.hpos, width); 1051 = WINDOW_LEFT_MARGIN (w) + minmax (0, pos.hpos, width);
1049 FRAME_CURSOR_Y (selected_frame) = this_line_vpos; 1052 FRAME_CURSOR_Y (selected_frame) = this_line_vpos;
1050 goto update; 1053 goto update;
1051 } 1054 }
@@ -1104,7 +1107,7 @@ redisplay_internal (preserve_echo_area)
1104 else if (FRAME_VISIBLE_P (selected_frame)) 1107 else if (FRAME_VISIBLE_P (selected_frame))
1105 { 1108 {
1106 redisplay_window (selected_window, 1, preserve_echo_area); 1109 redisplay_window (selected_window, 1, preserve_echo_area);
1107 if (XFASTINT (w->width) != FRAME_WIDTH (selected_frame)) 1110 if (!WINDOW_FULL_WIDTH_P (w))
1108 preserve_other_columns (w); 1111 preserve_other_columns (w);
1109 } 1112 }
1110 1113
@@ -1182,7 +1185,7 @@ update:
1182 may be null, so preserve_other_columns won't be able to 1185 may be null, so preserve_other_columns won't be able to
1183 preserve all the vertical-bar separators. So, avoid using it 1186 preserve all the vertical-bar separators. So, avoid using it
1184 in that case. */ 1187 in that case. */
1185 if (XFASTINT (w->width) != FRAME_WIDTH (selected_frame)) 1188 if (!WINDOW_FULL_WIDTH_P (w))
1186 update_mode_lines = 1; 1189 update_mode_lines = 1;
1187 } 1190 }
1188 1191
@@ -1478,7 +1481,9 @@ redisplay_window (window, just_this_one, preserve_echo_area)
1478 for (i = 0; i < height; i++) 1481 for (i = 0; i < height; i++)
1479 { 1482 {
1480 get_display_line (f, vpos + i, 0); 1483 get_display_line (f, vpos + i, 0);
1481 display_string (w, vpos + i, "", 0, 0, 0, 1, 0, width); 1484 display_string (w, vpos + i, "", 0,
1485 FRAME_LEFT_SCROLL_BAR_WIDTH (f),
1486 0, 1, 0, width);
1482 } 1487 }
1483 1488
1484 goto finish_scroll_bars; 1489 goto finish_scroll_bars;
@@ -1619,7 +1624,7 @@ redisplay_window (window, just_this_one, preserve_echo_area)
1619 { 1624 {
1620 if (current_buffer == old) 1625 if (current_buffer == old)
1621 lpoint = PT; 1626 lpoint = PT;
1622 FRAME_CURSOR_X (f) = (XFASTINT (w->left) 1627 FRAME_CURSOR_X (f) = (WINDOW_LEFT_MARGIN (w)
1623 + minmax (0, pos.hpos, width)); 1628 + minmax (0, pos.hpos, width));
1624 FRAME_CURSOR_Y (f) = pos.vpos + XFASTINT (w->top); 1629 FRAME_CURSOR_Y (f) = pos.vpos + XFASTINT (w->top);
1625 } 1630 }
@@ -1648,7 +1653,7 @@ redisplay_window (window, just_this_one, preserve_echo_area)
1648 if (XFASTINT (w->last_modified) >= MODIFF 1653 if (XFASTINT (w->last_modified) >= MODIFF
1649 && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF 1654 && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF
1650 && PT >= startp && !current_buffer->clip_changed 1655 && PT >= startp && !current_buffer->clip_changed
1651 && (just_this_one || XFASTINT (w->width) == FRAME_WIDTH (f)) 1656 && (just_this_one || WINDOW_FULL_WIDTH_P (w))
1652 /* If force-mode-line-update was called, really redisplay; 1657 /* If force-mode-line-update was called, really redisplay;
1653 that's how redisplay is forced after e.g. changing 1658 that's how redisplay is forced after e.g. changing
1654 buffer-invisibility-spec. */ 1659 buffer-invisibility-spec. */
@@ -1671,7 +1676,7 @@ redisplay_window (window, just_this_one, preserve_echo_area)
1671 if (w == XWINDOW (FRAME_SELECTED_WINDOW (f))) 1676 if (w == XWINDOW (FRAME_SELECTED_WINDOW (f)))
1672 { 1677 {
1673 /* These variables are supposed to be origin 1 */ 1678 /* These variables are supposed to be origin 1 */
1674 FRAME_CURSOR_X (f) = (XFASTINT (w->left) 1679 FRAME_CURSOR_X (f) = (WINDOW_LEFT_MARGIN (w)
1675 + minmax (0, pos.hpos, width)); 1680 + minmax (0, pos.hpos, width));
1676 FRAME_CURSOR_Y (f) = pos.vpos + XFASTINT (w->top); 1681 FRAME_CURSOR_Y (f) = pos.vpos + XFASTINT (w->top);
1677 } 1682 }
@@ -1679,7 +1684,7 @@ redisplay_window (window, just_this_one, preserve_echo_area)
1679 this one must be redisplayed, this does nothing because there 1684 this one must be redisplayed, this does nothing because there
1680 is nothing in DesiredFrame yet, and then the other window is 1685 is nothing in DesiredFrame yet, and then the other window is
1681 redisplayed, making likes that are empty in this window's columns. 1686 redisplayed, making likes that are empty in this window's columns.
1682 if (XFASTINT (w->width) != FRAME_WIDTH (f)) 1687 if (WINDOW_FULL_WIDTH_P (w))
1683 preserve_my_columns (w); 1688 preserve_my_columns (w);
1684 */ 1689 */
1685 goto done; 1690 goto done;
@@ -1703,7 +1708,7 @@ redisplay_window (window, just_this_one, preserve_echo_area)
1703 && ! EQ (w->window_end_valid, Qnil) 1708 && ! EQ (w->window_end_valid, Qnil)
1704 && do_id && !current_buffer->clip_changed 1709 && do_id && !current_buffer->clip_changed
1705 && !blank_end_of_window 1710 && !blank_end_of_window
1706 && XFASTINT (w->width) == FRAME_WIDTH (f) 1711 && WINDOW_FULL_WIDTH_P (w)
1707 /* Can't use this case if highlighting a region. */ 1712 /* Can't use this case if highlighting a region. */
1708 && !(!NILP (Vtransient_mark_mode) 1713 && !(!NILP (Vtransient_mark_mode)
1709 && !NILP (current_buffer->mark_active)) 1714 && !NILP (current_buffer->mark_active))
@@ -1827,7 +1832,7 @@ done:
1827 if ((update_mode_line 1832 if ((update_mode_line
1828 /* If window not full width, must redo its mode line 1833 /* If window not full width, must redo its mode line
1829 if the window to its side is being redone */ 1834 if the window to its side is being redone */
1830 || (!just_this_one && width < FRAME_WIDTH (f) - 1) 1835 || (!just_this_one && !WINDOW_FULL_WIDTH_P (w))
1831 || INTEGERP (w->base_line_pos) 1836 || INTEGERP (w->base_line_pos)
1832 || (!NILP (w->column_number_displayed) 1837 || (!NILP (w->column_number_displayed)
1833 && XFASTINT (w->column_number_displayed) != current_column ())) 1838 && XFASTINT (w->column_number_displayed) != current_column ()))
@@ -2140,7 +2145,7 @@ try_window_id (window)
2140 if (pp.bufpos < PT || pp.vpos == height) 2145 if (pp.bufpos < PT || pp.vpos == height)
2141 return 0; 2146 return 0;
2142 cursor_vpos = pp.vpos + top; 2147 cursor_vpos = pp.vpos + top;
2143 cursor_hpos = XFASTINT (w->left) + minmax (0, pp.hpos, width); 2148 cursor_hpos = WINDOW_LEFT_MARGIN (w) + minmax (0, pp.hpos, width);
2144 } 2149 }
2145 2150
2146 if (stop_vpos - scroll_amount >= height 2151 if (stop_vpos - scroll_amount >= height
@@ -2351,7 +2356,7 @@ try_window_id (window)
2351 return 0; 2356 return 0;
2352 } 2357 }
2353 cursor_vpos = val.vpos + top; 2358 cursor_vpos = val.vpos + top;
2354 cursor_hpos = XFASTINT (w->left) + minmax (0, val.hpos, width); 2359 cursor_hpos = WINDOW_LEFT_MARGIN (w) + minmax (0, val.hpos, width);
2355 } 2360 }
2356 2361
2357 FRAME_CURSOR_X (f) = cursor_hpos; 2362 FRAME_CURSOR_X (f) = cursor_hpos;
@@ -2500,7 +2505,7 @@ display_text_line (w, start, vpos, hpos, taboffset)
2500 int hscroll = XINT (w->hscroll); 2505 int hscroll = XINT (w->hscroll);
2501 int truncate = (hscroll 2506 int truncate = (hscroll
2502 || (truncate_partial_width_windows 2507 || (truncate_partial_width_windows
2503 && XFASTINT (w->width) < FRAME_WIDTH (f)) 2508 && !WINDOW_FULL_WIDTH_P (w))
2504 || !NILP (current_buffer->truncate_lines)); 2509 || !NILP (current_buffer->truncate_lines));
2505 2510
2506 /* 1 if we should highlight the region. */ 2511 /* 1 if we should highlight the region. */
@@ -2551,8 +2556,8 @@ display_text_line (w, start, vpos, hpos, taboffset)
2551 XSETFASTINT (default_invis_vector[2], '.'); 2556 XSETFASTINT (default_invis_vector[2], '.');
2552 default_invis_vector[0] = default_invis_vector[1] = default_invis_vector[2]; 2557 default_invis_vector[0] = default_invis_vector[1] = default_invis_vector[2];
2553 2558
2554 hpos += XFASTINT (w->left); 2559 hpos += WINDOW_LEFT_MARGIN (w);
2555 get_display_line (f, vpos, XFASTINT (w->left)); 2560 get_display_line (f, vpos, WINDOW_LEFT_MARGIN (w));
2556 if (tab_width <= 0 || tab_width > 1000) tab_width = 8; 2561 if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
2557 2562
2558 /* Show where to highlight the region. */ 2563 /* Show where to highlight the region. */
@@ -2634,8 +2639,8 @@ display_text_line (w, start, vpos, hpos, taboffset)
2634 p1start = p1; 2639 p1start = p1;
2635 charstart = desired_glyphs->charstarts[vpos] + hpos; 2640 charstart = desired_glyphs->charstarts[vpos] + hpos;
2636 /* In case we don't ever write anything into it... */ 2641 /* In case we don't ever write anything into it... */
2637 desired_glyphs->charstarts[vpos][XFASTINT (w->left)] = -1; 2642 desired_glyphs->charstarts[vpos][WINDOW_LEFT_MARGIN (w)] = -1;
2638 leftmargin = desired_glyphs->glyphs[vpos] + XFASTINT (w->left); 2643 leftmargin = desired_glyphs->glyphs[vpos] + WINDOW_LEFT_MARGIN (w);
2639 endp = leftmargin + width; 2644 endp = leftmargin + width;
2640 2645
2641 /* Arrange the overlays nicely for our purposes. Usually, we call 2646 /* Arrange the overlays nicely for our purposes. Usually, we call
@@ -3084,7 +3089,7 @@ display_text_line (w, start, vpos, hpos, taboffset)
3084 { 3089 {
3085 if (cursor_hpos < 0) cursor_hpos = 0; 3090 if (cursor_hpos < 0) cursor_hpos = 0;
3086 if (cursor_hpos > width) cursor_hpos = width; 3091 if (cursor_hpos > width) cursor_hpos = width;
3087 cursor_hpos += XFASTINT (w->left); 3092 cursor_hpos += WINDOW_LEFT_MARGIN (w);
3088 if (w == XWINDOW (FRAME_SELECTED_WINDOW (f))) 3093 if (w == XWINDOW (FRAME_SELECTED_WINDOW (f)))
3089 { 3094 {
3090 if (!(cursor_in_echo_area && FRAME_HAS_MINIBUF_P (f) 3095 if (!(cursor_in_echo_area && FRAME_HAS_MINIBUF_P (f)
@@ -3098,7 +3103,7 @@ display_text_line (w, start, vpos, hpos, taboffset)
3098 { 3103 {
3099 /* Line is not continued and did not start 3104 /* Line is not continued and did not start
3100 in middle of character */ 3105 in middle of character */
3101 if ((hpos - XFASTINT (w->left) 3106 if ((hpos - WINDOW_LEFT_MARGIN (w)
3102 == (XINT (w->hscroll) ? 1 - XINT (w->hscroll) : 0)) 3107 == (XINT (w->hscroll) ? 1 - XINT (w->hscroll) : 0))
3103 && val.vpos) 3108 && val.vpos)
3104 { 3109 {
@@ -3122,7 +3127,7 @@ display_text_line (w, start, vpos, hpos, taboffset)
3122 p1 = leftmargin + 1; 3127 p1 = leftmargin + 1;
3123 } 3128 }
3124 3129
3125 if (XFASTINT (w->width) + XFASTINT (w->left) != FRAME_WIDTH (f)) 3130 if (!WINDOW_RIGHTMOST_P (w))
3126 { 3131 {
3127 endp++; 3132 endp++;
3128 if (p1 < leftmargin) p1 = leftmargin; 3133 if (p1 < leftmargin) p1 = leftmargin;
@@ -3132,13 +3137,13 @@ display_text_line (w, start, vpos, hpos, taboffset)
3132 covered up by the scroll bars, and it's distracting to see 3137 covered up by the scroll bars, and it's distracting to see
3133 them when the scroll bar windows are flickering around to be 3138 them when the scroll bar windows are flickering around to be
3134 reconfigured. */ 3139 reconfigured. */
3135 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) 3140 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f))
3136 { 3141 {
3137 int i; 3142 int i;
3138 for (i = 0; i < FRAME_SCROLL_BAR_COLS (f); i++) 3143 for (i = 0; i < FRAME_SCROLL_BAR_COLS (f); i++)
3139 *p1++ = SPACEGLYPH; 3144 *p1++ = SPACEGLYPH;
3140 } 3145 }
3141 else 3146 else if (!FRAME_HAS_VERTICAL_SCROLL_BARS (f))
3142 *p1++ = (dp && INTEGERP (DISP_BORDER_GLYPH (dp)) 3147 *p1++ = (dp && INTEGERP (DISP_BORDER_GLYPH (dp))
3143 ? DISP_BORDER_GLYPH (dp) 3148 ? DISP_BORDER_GLYPH (dp)
3144 : '|'); 3149 : '|');
@@ -3268,8 +3273,8 @@ display_mode_line (w)
3268 struct window *w; 3273 struct window *w;
3269{ 3274{
3270 register int vpos = XFASTINT (w->height) + XFASTINT (w->top) - 1; 3275 register int vpos = XFASTINT (w->height) + XFASTINT (w->top) - 1;
3271 register int left = XFASTINT (w->left); 3276 register int left = WINDOW_LEFT_MARGIN (w);
3272 register int right = XFASTINT (w->width) + left; 3277 register int right = WINDOW_RIGHT_MARGIN (w);
3273 register FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); 3278 register FRAME_PTR f = XFRAME (WINDOW_FRAME (w));
3274 3279
3275 line_number_displayed = 0; 3280 line_number_displayed = 0;
@@ -3289,17 +3294,11 @@ display_mode_line (w)
3289 3294
3290 FRAME_DESIRED_GLYPHS (f)->bufp[vpos] = 0; 3295 FRAME_DESIRED_GLYPHS (f)->bufp[vpos] = 0;
3291 3296
3292 /* Make the mode line inverse video if the entire line 3297 /* Put the mode line in inverse video.
3293 is made of mode lines. 3298 Use faces if possible, since that lets us handle
3294 I.e. if this window is full width, 3299 partial-width windows and avoid inverting the scroll bar columns. */
3295 or if it is the child of a full width window
3296 (which implies that that window is split side-by-side
3297 and the rest of this line is mode lines of the sibling windows). */
3298 if (XFASTINT (w->width) == FRAME_WIDTH (f)
3299 || XFASTINT (XWINDOW (w->parent)->width) == FRAME_WIDTH (f))
3300 FRAME_DESIRED_GLYPHS (f)->highlight[vpos] = mode_line_inverse_video;
3301#ifdef HAVE_FACES 3300#ifdef HAVE_FACES
3302 else if (! FRAME_TERMCAP_P (f) && mode_line_inverse_video) 3301 if (! FRAME_TERMCAP_P (f) && mode_line_inverse_video)
3303 { 3302 {
3304 /* For a partial width window, explicitly set face of each glyph. */ 3303 /* For a partial width window, explicitly set face of each glyph. */
3305 int i; 3304 int i;
@@ -3308,6 +3307,16 @@ display_mode_line (w)
3308 ptr[i] = FAST_MAKE_GLYPH (FAST_GLYPH_CHAR (ptr[i]), 1); 3307 ptr[i] = FAST_MAKE_GLYPH (FAST_GLYPH_CHAR (ptr[i]), 1);
3309 } 3308 }
3310#endif 3309#endif
3310
3311 /* Make the mode line inverse video if the entire line
3312 is made of mode lines.
3313 I.e. if this window is full width,
3314 or if it is the child of a full width window
3315 (which implies that that window is split side-by-side
3316 and the rest of this line is mode lines of the sibling windows). */
3317 else if (WINDOW_FULL_WIDTH_P (w)
3318 || WINDOW_FULL_WIDTH_P (XWINDOW (w->parent)))
3319 FRAME_DESIRED_GLYPHS (f)->highlight[vpos] = mode_line_inverse_video;
3311} 3320}
3312 3321
3313/* Contribute ELT to the mode line for window W. 3322/* Contribute ELT to the mode line for window W.
@@ -4089,16 +4098,16 @@ display_string (w, vpos, string, length, hpos, truncate,
4089 { 4098 {
4090 end = start + window_width - (truncate != 0); 4099 end = start + window_width - (truncate != 0);
4091 4100
4092 if ((window_width + XFASTINT (w->left)) != FRAME_WIDTH (f)) 4101 if (!WINDOW_RIGHTMOST_P (w))
4093 { 4102 {
4094 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) 4103 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f))
4095 { 4104 {
4096 int i; 4105 int i;
4097 4106
4098 for (i = 0; i < FRAME_SCROLL_BAR_COLS (f); i++) 4107 for (i = 0; i < FRAME_SCROLL_BAR_COLS (f); i++)
4099 *end-- = ' '; 4108 *end-- = ' ';
4100 } 4109 }
4101 else 4110 else if (!FRAME_HAS_VERTICAL_SCROLL_BARS (f))
4102 *end-- = '|'; 4111 *end-- = '|';
4103 } 4112 }
4104 } 4113 }