diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 97 |
1 files changed, 58 insertions, 39 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index b4b502884aa..8ad0b6be119 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | /* Display generation from window structure and buffer text. | 1 | /* Display generation from window structure and buffer text. |
| 2 | Copyright (C) 1985, 1986, 1987, 1988, 1992 Free Software Foundation, Inc. | 2 | Copyright (C) 1985, 1986, 1987, 1988, 1992, 1993 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is part of GNU Emacs. | 4 | This file is part of GNU Emacs. |
| 5 | 5 | ||
| 6 | GNU Emacs is free software; you can redistribute it and/or modify | 6 | GNU Emacs is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 1, or (at your option) | 8 | the Free Software Foundation; either version 2, or (at your option) |
| 9 | any later version. | 9 | any later version. |
| 10 | 10 | ||
| 11 | GNU Emacs is distributed in the hope that it will be useful, | 11 | GNU Emacs is distributed in the hope that it will be useful, |
| @@ -274,11 +274,12 @@ echo_area_display () | |||
| 274 | 274 | ||
| 275 | #ifdef MULTI_FRAME | 275 | #ifdef MULTI_FRAME |
| 276 | choose_minibuf_frame (); | 276 | choose_minibuf_frame (); |
| 277 | #endif | ||
| 278 | |||
| 277 | f = XFRAME (WINDOW_FRAME (XWINDOW (minibuf_window))); | 279 | f = XFRAME (WINDOW_FRAME (XWINDOW (minibuf_window))); |
| 278 | 280 | ||
| 279 | if (! FRAME_VISIBLE_P (f)) | 281 | if (! FRAME_VISIBLE_P (f)) |
| 280 | return; | 282 | return; |
| 281 | #endif | ||
| 282 | 283 | ||
| 283 | if (frame_garbaged) | 284 | if (frame_garbaged) |
| 284 | { | 285 | { |
| @@ -465,9 +466,7 @@ redisplay () | |||
| 465 | pos = *compute_motion (tlbufpos, 0, | 466 | pos = *compute_motion (tlbufpos, 0, |
| 466 | XINT (w->hscroll) ? 1 - XINT (w->hscroll) : 0, | 467 | XINT (w->hscroll) ? 1 - XINT (w->hscroll) : 0, |
| 467 | point, 2, - (1 << (SHORTBITS - 1)), | 468 | point, 2, - (1 << (SHORTBITS - 1)), |
| 468 | XFASTINT (w->width) - 1 | 469 | window_internal_width (w) - 1, |
| 469 | - (XFASTINT (w->width) + XFASTINT (w->left) | ||
| 470 | != FRAME_WIDTH (selected_frame)), | ||
| 471 | XINT (w->hscroll), | 470 | XINT (w->hscroll), |
| 472 | pos_tab_offset (w, tlbufpos)); | 471 | pos_tab_offset (w, tlbufpos)); |
| 473 | if (pos.vpos < 1) | 472 | if (pos.vpos < 1) |
| @@ -501,7 +500,7 @@ redisplay () | |||
| 501 | { | 500 | { |
| 502 | /* Mark all the scrollbars to be removed; we'll redeem the ones | 501 | /* Mark all the scrollbars to be removed; we'll redeem the ones |
| 503 | we want when we redisplay their windows. */ | 502 | we want when we redisplay their windows. */ |
| 504 | if (FRAME_HAS_VERTICAL_SCROLLBARS (f)) | 503 | if (condemn_scrollbars_hook) |
| 505 | (*condemn_scrollbars_hook) (f); | 504 | (*condemn_scrollbars_hook) (f); |
| 506 | 505 | ||
| 507 | if (FRAME_VISIBLE_P (f)) | 506 | if (FRAME_VISIBLE_P (f)) |
| @@ -509,7 +508,7 @@ redisplay () | |||
| 509 | 508 | ||
| 510 | /* Any scrollbars which redisplay_windows should have nuked | 509 | /* Any scrollbars which redisplay_windows should have nuked |
| 511 | should now go away. */ | 510 | should now go away. */ |
| 512 | if (FRAME_HAS_VERTICAL_SCROLLBARS (f)) | 511 | if (judge_scrollbars_hook) |
| 513 | (*judge_scrollbars_hook) (f); | 512 | (*judge_scrollbars_hook) (f); |
| 514 | } | 513 | } |
| 515 | } | 514 | } |
| @@ -714,12 +713,11 @@ redisplay_window (window, just_this_one) | |||
| 714 | int height; | 713 | int height; |
| 715 | register int lpoint = point; | 714 | register int lpoint = point; |
| 716 | struct buffer *old = current_buffer; | 715 | struct buffer *old = current_buffer; |
| 717 | register int width = XFASTINT (w->width) - 1 | 716 | register int width = window_internal_width (w) - 1; |
| 718 | - (XFASTINT (w->width) + XFASTINT (w->left) != FRAME_WIDTH (f)); | ||
| 719 | register int startp; | 717 | register int startp; |
| 720 | register int hscroll = XINT (w->hscroll); | 718 | register int hscroll = XINT (w->hscroll); |
| 721 | struct position pos; | 719 | struct position pos; |
| 722 | int opoint; | 720 | int opoint = point; |
| 723 | int tem; | 721 | int tem; |
| 724 | int window_needs_modeline; | 722 | int window_needs_modeline; |
| 725 | 723 | ||
| @@ -748,7 +746,7 @@ redisplay_window (window, just_this_one) | |||
| 748 | { | 746 | { |
| 749 | if (echo_area_glyphs) | 747 | if (echo_area_glyphs) |
| 750 | /* We've already displayed the echo area glyphs, if any. */ | 748 | /* We've already displayed the echo area glyphs, if any. */ |
| 751 | return; | 749 | goto finish_scrollbars; |
| 752 | } | 750 | } |
| 753 | else | 751 | else |
| 754 | { | 752 | { |
| @@ -763,7 +761,7 @@ redisplay_window (window, just_this_one) | |||
| 763 | display_string (w, vpos + i, "", 0, 0, 0, width); | 761 | display_string (w, vpos + i, "", 0, 0, 0, width); |
| 764 | } | 762 | } |
| 765 | 763 | ||
| 766 | return; | 764 | goto finish_scrollbars; |
| 767 | } | 765 | } |
| 768 | } | 766 | } |
| 769 | 767 | ||
| @@ -967,28 +965,36 @@ done: | |||
| 967 | && height != XFASTINT (w->height)) | 965 | && height != XFASTINT (w->height)) |
| 968 | display_mode_line (w); | 966 | display_mode_line (w); |
| 969 | 967 | ||
| 970 | SET_PT (opoint); | 968 | finish_scrollbars: |
| 971 | current_buffer = old; | ||
| 972 | SET_PT (lpoint); | ||
| 973 | |||
| 974 | if (FRAME_HAS_VERTICAL_SCROLLBARS (f)) | 969 | if (FRAME_HAS_VERTICAL_SCROLLBARS (f)) |
| 975 | { | 970 | { |
| 976 | struct scrollbar *bar = WINDOW_VERTICAL_SCROLLBAR (w); | 971 | int start, end, whole; |
| 977 | 972 | ||
| 978 | /* This isn't guaranteed to be right. For the moment, we'll pretend | 973 | /* Calculate the start and end positions for the current window. |
| 979 | it is. */ | 974 | Note that minibuffers sometimes aren't displaying any text. */ |
| 980 | int endp = Z - XINT (w->window_end_pos); | 975 | if (! MINI_WINDOW_P (w) |
| 976 | || (w == XWINDOW (minibuf_window) && ! echo_area_glyphs)) | ||
| 977 | { | ||
| 978 | start = startp; | ||
| 979 | /* I don't think this is guaranteed to be right. For the | ||
| 980 | moment, we'll pretend it is. */ | ||
| 981 | end = Z - XINT (w->window_end_pos); | ||
| 982 | whole = Z - BEG; | ||
| 983 | } | ||
| 984 | else | ||
| 985 | start = end = whole = 0; | ||
| 981 | 986 | ||
| 982 | /* Indicate what this scrollbar ought to be displaying now. */ | 987 | /* Indicate what this scrollbar ought to be displaying now. */ |
| 983 | bar = ((*set_vertical_scrollbar_hook) | 988 | (*set_vertical_scrollbar_hook) (w, end - start, whole, start - 1); |
| 984 | (bar, w, endp - startp, Z - BEG, startp)); | ||
| 985 | 989 | ||
| 986 | /* Note that we actually used the scrollbar attached to this window, | 990 | /* Note that we actually used the scrollbar attached to this window, |
| 987 | so it shouldn't be deleted at the end of redisplay. */ | 991 | so it shouldn't be deleted at the end of redisplay. */ |
| 988 | (*redeem_scrollbar_hook) (bar); | 992 | (*redeem_scrollbar_hook) (w); |
| 989 | |||
| 990 | XSET (w->vertical_scrollbar, Lisp_Int, bar); | ||
| 991 | } | 993 | } |
| 994 | |||
| 995 | SET_PT (opoint); | ||
| 996 | current_buffer = old; | ||
| 997 | SET_PT (lpoint); | ||
| 992 | } | 998 | } |
| 993 | 999 | ||
| 994 | /* Do full redisplay on one window, starting at position `pos'. */ | 1000 | /* Do full redisplay on one window, starting at position `pos'. */ |
| @@ -1004,8 +1010,7 @@ try_window (window, pos) | |||
| 1004 | register int last_text_vpos = vpos; | 1010 | register int last_text_vpos = vpos; |
| 1005 | int tab_offset = pos_tab_offset (w, pos); | 1011 | int tab_offset = pos_tab_offset (w, pos); |
| 1006 | FRAME_PTR f = XFRAME (w->frame); | 1012 | FRAME_PTR f = XFRAME (w->frame); |
| 1007 | int width = XFASTINT (w->width) - 1 | 1013 | int width = window_internal_width (w) - 1; |
| 1008 | - (XFASTINT (w->width) + XFASTINT (w->left) != FRAME_WIDTH (f)); | ||
| 1009 | struct position val; | 1014 | struct position val; |
| 1010 | 1015 | ||
| 1011 | Fset_marker (w->start, make_number (pos), Qnil); | 1016 | Fset_marker (w->start, make_number (pos), Qnil); |
| @@ -1060,8 +1065,7 @@ try_window_id (window) | |||
| 1060 | FRAME_PTR f = XFRAME (w->frame); | 1065 | FRAME_PTR f = XFRAME (w->frame); |
| 1061 | int top = XFASTINT (w->top); | 1066 | int top = XFASTINT (w->top); |
| 1062 | int start = marker_position (w->start); | 1067 | int start = marker_position (w->start); |
| 1063 | int width = XFASTINT (w->width) - 1 | 1068 | int width = window_internal_width (w) - 1; |
| 1064 | - (XFASTINT (w->width) + XFASTINT (w->left) != FRAME_WIDTH (f)); | ||
| 1065 | int hscroll = XINT (w->hscroll); | 1069 | int hscroll = XINT (w->hscroll); |
| 1066 | int lmargin = hscroll > 0 ? 1 - hscroll : 0; | 1070 | int lmargin = hscroll > 0 ? 1 - hscroll : 0; |
| 1067 | register int vpos; | 1071 | register int vpos; |
| @@ -1476,8 +1480,7 @@ display_text_line (w, start, vpos, hpos, taboffset) | |||
| 1476 | FRAME_PTR f = XFRAME (w->frame); | 1480 | FRAME_PTR f = XFRAME (w->frame); |
| 1477 | int tab_width = XINT (current_buffer->tab_width); | 1481 | int tab_width = XINT (current_buffer->tab_width); |
| 1478 | int ctl_arrow = !NILP (current_buffer->ctl_arrow); | 1482 | int ctl_arrow = !NILP (current_buffer->ctl_arrow); |
| 1479 | int width = XFASTINT (w->width) - 1 | 1483 | int width = window_internal_width (w) - 1; |
| 1480 | - (XFASTINT (w->width) + XFASTINT (w->left) != FRAME_WIDTH (f)); | ||
| 1481 | struct position val; | 1484 | struct position val; |
| 1482 | int lastpos; | 1485 | int lastpos; |
| 1483 | int invis; | 1486 | int invis; |
| @@ -1743,7 +1746,13 @@ display_text_line (w, start, vpos, hpos, taboffset) | |||
| 1743 | endp++; | 1746 | endp++; |
| 1744 | if (p1 < startp) p1 = startp; | 1747 | if (p1 < startp) p1 = startp; |
| 1745 | while (p1 < endp) *p1++ = SPACEGLYPH; | 1748 | while (p1 < endp) *p1++ = SPACEGLYPH; |
| 1746 | *p1++ = '|'; | 1749 | |
| 1750 | /* Don't draw vertical bars if we're using scrollbars. They're | ||
| 1751 | covered up by the scrollbars, and it's distracting to see | ||
| 1752 | them when the scrollbar windows are flickering around to be | ||
| 1753 | reconfigured. */ | ||
| 1754 | *p1++ = (FRAME_HAS_VERTICAL_SCROLLBARS (f) | ||
| 1755 | ? ' ' : '|'); | ||
| 1747 | } | 1756 | } |
| 1748 | desired_glyphs->used[vpos] = max (desired_glyphs->used[vpos], | 1757 | desired_glyphs->used[vpos] = max (desired_glyphs->used[vpos], |
| 1749 | p1 - desired_glyphs->glyphs[vpos]); | 1758 | p1 - desired_glyphs->glyphs[vpos]); |
| @@ -1762,8 +1771,8 @@ display_text_line (w, start, vpos, hpos, taboffset) | |||
| 1762 | int i; | 1771 | int i; |
| 1763 | int len = XSTRING (Voverlay_arrow_string)->size; | 1772 | int len = XSTRING (Voverlay_arrow_string)->size; |
| 1764 | 1773 | ||
| 1765 | if (len > XFASTINT (w->width) - 1) | 1774 | if (len > width) |
| 1766 | len = XFASTINT (w->width) - 1; | 1775 | len = width; |
| 1767 | for (i = 0; i < len; i++) | 1776 | for (i = 0; i < len; i++) |
| 1768 | startp[i] = p[i]; | 1777 | startp[i] = p[i]; |
| 1769 | if (desired_glyphs->used[vpos] < | 1778 | if (desired_glyphs->used[vpos] < |
| @@ -2214,7 +2223,8 @@ display_string (w, vpos, string, hpos, truncate, mincol, maxcol) | |||
| 2214 | int tab_width = XINT (XBUFFER (w->buffer)->tab_width); | 2223 | int tab_width = XINT (XBUFFER (w->buffer)->tab_width); |
| 2215 | register GLYPH *start; | 2224 | register GLYPH *start; |
| 2216 | register GLYPH *end; | 2225 | register GLYPH *end; |
| 2217 | struct frame_glyphs *desired_glyphs = FRAME_DESIRED_GLYPHS (XFRAME (w->frame)); | 2226 | FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); |
| 2227 | struct frame_glyphs *desired_glyphs = FRAME_DESIRED_GLYPHS (f); | ||
| 2218 | GLYPH *p1start = desired_glyphs->glyphs[vpos] + hpos; | 2228 | GLYPH *p1start = desired_glyphs->glyphs[vpos] + hpos; |
| 2219 | int window_width = XFASTINT (w->width); | 2229 | int window_width = XFASTINT (w->width); |
| 2220 | 2230 | ||
| @@ -2232,9 +2242,18 @@ display_string (w, vpos, string, hpos, truncate, mincol, maxcol) | |||
| 2232 | start = desired_glyphs->glyphs[vpos] + XFASTINT (w->left); | 2242 | start = desired_glyphs->glyphs[vpos] + XFASTINT (w->left); |
| 2233 | end = start + window_width - (truncate != 0); | 2243 | end = start + window_width - (truncate != 0); |
| 2234 | 2244 | ||
| 2235 | if ((window_width + XFASTINT (w->left)) | 2245 | if ((window_width + XFASTINT (w->left)) != FRAME_WIDTH (f)) |
| 2236 | != FRAME_WIDTH (XFRAME (WINDOW_FRAME (w)))) | 2246 | { |
| 2237 | *end-- = '|'; | 2247 | if (FRAME_HAS_VERTICAL_SCROLLBARS (f)) |
| 2248 | { | ||
| 2249 | int i; | ||
| 2250 | |||
| 2251 | for (i = 0; i < VERTICAL_SCROLLBAR_WIDTH; i++) | ||
| 2252 | *end-- = ' '; | ||
| 2253 | } | ||
| 2254 | else | ||
| 2255 | *end-- = '|'; | ||
| 2256 | } | ||
| 2238 | 2257 | ||
| 2239 | if (maxcol >= 0 && end - desired_glyphs->glyphs[vpos] > maxcol) | 2258 | if (maxcol >= 0 && end - desired_glyphs->glyphs[vpos] > maxcol) |
| 2240 | end = desired_glyphs->glyphs[vpos] + maxcol; | 2259 | end = desired_glyphs->glyphs[vpos] + maxcol; |