diff options
| author | Jim Blandy | 1994-10-08 22:16:04 +0000 |
|---|---|---|
| committer | Jim Blandy | 1994-10-08 22:16:04 +0000 |
| commit | f4faa47c569dd7b5105a139c7fff343a34f559b9 (patch) | |
| tree | 8f45e14eac9bbb6728584592445750a7e701bc94 /src | |
| parent | be5357e28ee4d76098454c10b500c41a3031c227 (diff) | |
| download | emacs-f4faa47c569dd7b5105a139c7fff343a34f559b9.tar.gz emacs-f4faa47c569dd7b5105a139c7fff343a34f559b9.zip | |
* xdisp.c (redisplay_window): Invalidate width_run_cache, if the
buffer's display table doesn't match the width table the cache was
built for.
(display_text_line): Use compute_motion to skip forward to the
left edge of the window when the window is hscrolled; this is
faster than rendering all the characters into the bit bucket when
the hscroll is large.
Doc fixes.
(display_count_lines): Call scan_buffer with new args.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 75 |
1 files changed, 66 insertions, 9 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 7f3d05deec4..7b464dfa74e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -1126,6 +1126,25 @@ redisplay_window (window, just_this_one) | |||
| 1126 | BUF_PT (current_buffer) = new_pt; | 1126 | BUF_PT (current_buffer) = new_pt; |
| 1127 | } | 1127 | } |
| 1128 | 1128 | ||
| 1129 | /* If any of the character widths specified in the display table | ||
| 1130 | have changed, invalidate the width run cache. It's true that this | ||
| 1131 | may be a bit late to catch such changes, but the rest of | ||
| 1132 | redisplay goes (non-fatally) haywire when the display table is | ||
| 1133 | changed, so why should we worry about doing any better? */ | ||
| 1134 | if (current_buffer->width_run_cache) | ||
| 1135 | { | ||
| 1136 | struct Lisp_Vector *disptab = buffer_display_table (); | ||
| 1137 | |||
| 1138 | if (! disptab_matches_widthtab (disptab, | ||
| 1139 | XVECTOR (current_buffer->width_table))) | ||
| 1140 | { | ||
| 1141 | invalidate_region_cache (current_buffer, | ||
| 1142 | current_buffer->width_run_cache, | ||
| 1143 | BEG, Z); | ||
| 1144 | recompute_width_table (current_buffer, disptab); | ||
| 1145 | } | ||
| 1146 | } | ||
| 1147 | |||
| 1129 | /* If window-start is screwed up, choose a new one. */ | 1148 | /* If window-start is screwed up, choose a new one. */ |
| 1130 | if (XMARKER (w->start)->buffer != current_buffer) | 1149 | if (XMARKER (w->start)->buffer != current_buffer) |
| 1131 | goto recenter; | 1150 | goto recenter; |
| @@ -1984,15 +2003,20 @@ fix_glyph (f, glyph, cface) | |||
| 1984 | return glyph; | 2003 | return glyph; |
| 1985 | } | 2004 | } |
| 1986 | 2005 | ||
| 1987 | /* Display one line of window w, starting at position START in W's buffer. | 2006 | /* Display one line of window W, starting at position START in W's buffer. |
| 1988 | Display starting at horizontal position HPOS, which is normally zero | 2007 | |
| 1989 | or negative. A negative value causes output up to hpos = 0 to be discarded. | 2008 | Display starting at horizontal position HPOS, expressed relative to |
| 1990 | This is done for negative hscroll, or when this is a continuation line | 2009 | W's left edge. In situations where the text at START shouldn't |
| 1991 | and the continuation occurred in the middle of a multi-column character. | 2010 | start at the left margin (i.e. when the window is hscrolled, or |
| 2011 | we're continuing a line which left off in the midst of a | ||
| 2012 | multi-column character), HPOS should be negative; we throw away | ||
| 2013 | characters up 'til hpos = 0. So, HPOS must take hscrolling into | ||
| 2014 | account. | ||
| 1992 | 2015 | ||
| 1993 | TABOFFSET is an offset for ostensible hpos, used in tab stop calculations. | 2016 | TABOFFSET is an offset for ostensible hpos, used in tab stop calculations. |
| 1994 | 2017 | ||
| 1995 | Display on position VPOS on the frame. (origin 0). | 2018 | Display on position VPOS on the frame. It is origin 0, relative to |
| 2019 | the top of the frame, not W. | ||
| 1996 | 2020 | ||
| 1997 | Returns a STRUCT POSITION giving character to start next line with | 2021 | Returns a STRUCT POSITION giving character to start next line with |
| 1998 | and where to display it, including a zero or negative hpos. | 2022 | and where to display it, including a zero or negative hpos. |
| @@ -2102,7 +2126,8 @@ display_text_line (w, start, vpos, hpos, taboffset) | |||
| 2102 | else | 2126 | else |
| 2103 | region_beg = region_end = -1; | 2127 | region_beg = region_end = -1; |
| 2104 | 2128 | ||
| 2105 | if (MINI_WINDOW_P (w) && start == 1 | 2129 | if (MINI_WINDOW_P (w) |
| 2130 | && start == 1 | ||
| 2106 | && vpos == XFASTINT (w->top)) | 2131 | && vpos == XFASTINT (w->top)) |
| 2107 | { | 2132 | { |
| 2108 | if (! NILP (minibuf_prompt)) | 2133 | if (! NILP (minibuf_prompt)) |
| @@ -2119,13 +2144,45 @@ display_text_line (w, start, vpos, hpos, taboffset) | |||
| 2119 | minibuf_prompt_width = 0; | 2144 | minibuf_prompt_width = 0; |
| 2120 | } | 2145 | } |
| 2121 | 2146 | ||
| 2122 | desired_glyphs->bufp[vpos] = pos; | 2147 | end = ZV; |
| 2148 | |||
| 2149 | /* If we're hscrolled at all, use compute_motion to skip over any | ||
| 2150 | text off the left edge of the window. compute_motion may know | ||
| 2151 | tricks to do this faster than we can. */ | ||
| 2152 | if (hpos < 0) | ||
| 2153 | { | ||
| 2154 | struct position *left_edge | ||
| 2155 | = compute_motion (pos, vpos, hpos, | ||
| 2156 | end, vpos, 0, | ||
| 2157 | width, hscroll, taboffset, w); | ||
| 2158 | |||
| 2159 | /* Retrieve the buffer position and column provided by | ||
| 2160 | compute_motion. We can't assume that the column will be | ||
| 2161 | zero, because you may have multi-column characters crossing | ||
| 2162 | the left margin. | ||
| 2163 | |||
| 2164 | compute_motion may have moved us past the screen position we | ||
| 2165 | requested, if we hit a multi-column character, or the end of | ||
| 2166 | the line. If so, back up. */ | ||
| 2167 | if (left_edge->vpos > vpos | ||
| 2168 | || left_edge->hpos > 0) | ||
| 2169 | { | ||
| 2170 | pos = left_edge->bufpos - 1; | ||
| 2171 | hpos = left_edge->prevhpos; | ||
| 2172 | } | ||
| 2173 | else | ||
| 2174 | { | ||
| 2175 | pos = left_edge->bufpos; | ||
| 2176 | hpos = left_edge->hpos; | ||
| 2177 | } | ||
| 2178 | } | ||
| 2179 | |||
| 2180 | desired_glyphs->bufp[vpos] = start; | ||
| 2123 | p1 = desired_glyphs->glyphs[vpos] + hpos; | 2181 | p1 = desired_glyphs->glyphs[vpos] + hpos; |
| 2124 | p1start = p1; | 2182 | p1start = p1; |
| 2125 | charstart = desired_glyphs->charstarts[vpos] + hpos; | 2183 | charstart = desired_glyphs->charstarts[vpos] + hpos; |
| 2126 | /* In case we don't ever write anything into it... */ | 2184 | /* In case we don't ever write anything into it... */ |
| 2127 | desired_glyphs->charstarts[vpos][XFASTINT (w->left)] = -1; | 2185 | desired_glyphs->charstarts[vpos][XFASTINT (w->left)] = -1; |
| 2128 | end = ZV; | ||
| 2129 | leftmargin = desired_glyphs->glyphs[vpos] + XFASTINT (w->left); | 2186 | leftmargin = desired_glyphs->glyphs[vpos] + XFASTINT (w->left); |
| 2130 | endp = leftmargin + width; | 2187 | endp = leftmargin + width; |
| 2131 | 2188 | ||