diff options
| author | Richard M. Stallman | 1994-02-06 08:04:54 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-02-06 08:04:54 +0000 |
| commit | 278feba9ce82a494b7ff14e695fc80fc0ed9cc16 (patch) | |
| tree | 59ea297ccf42865ddfa3712b9bf24ad7ea7801a7 /src | |
| parent | 50f580011d1792ecbda0284d19bf8fb6e63b7a13 (diff) | |
| download | emacs-278feba9ce82a494b7ff14e695fc80fc0ed9cc16.tar.gz emacs-278feba9ce82a494b7ff14e695fc80fc0ed9cc16.zip | |
(fix_glyph): New function.
(display_text_line, display_string): Use fix_glyph.
(copy_rope): Function deleted.
(copy_part_of_rope): Merge the glyph's face using compute_glyph_face.
Take frame as additional arg.
(display_text_line): Use copy_part_of_rope always, not copy_rope.
Pass the frame as arg.
(display_string): Likewise.
(display_count_lines): Pass new arg to scan_buffer.
(display_menu_bar): Pass explicit max arg to display_string.
(display_string): New arg OBEY_WINDOW_WIDTH. All callers changed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 197 |
1 files changed, 112 insertions, 85 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 2fd2e6ee629..bd6165b9e59 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -399,7 +399,7 @@ echo_area_display () | |||
| 399 | display_string (XWINDOW (minibuf_window), vpos, | 399 | display_string (XWINDOW (minibuf_window), vpos, |
| 400 | echo_area_glyphs ? echo_area_glyphs : "", | 400 | echo_area_glyphs ? echo_area_glyphs : "", |
| 401 | echo_area_glyphs ? echo_area_glyphs_length : -1, | 401 | echo_area_glyphs ? echo_area_glyphs_length : -1, |
| 402 | 0, 0, 0, FRAME_WIDTH (f)); | 402 | 0, 0, 0, 0, FRAME_WIDTH (f)); |
| 403 | 403 | ||
| 404 | /* If desired cursor location is on this line, put it at end of text */ | 404 | /* If desired cursor location is on this line, put it at end of text */ |
| 405 | if (FRAME_CURSOR_Y (f) == vpos) | 405 | if (FRAME_CURSOR_Y (f) == vpos) |
| @@ -414,7 +414,7 @@ echo_area_display () | |||
| 414 | { | 414 | { |
| 415 | get_display_line (f, i, 0); | 415 | get_display_line (f, i, 0); |
| 416 | display_string (XWINDOW (minibuf_window), vpos, | 416 | display_string (XWINDOW (minibuf_window), vpos, |
| 417 | "", 0, 0, 0, 0, FRAME_WIDTH (f)); | 417 | "", 0, 0, 0, 0, 0, FRAME_WIDTH (f)); |
| 418 | } | 418 | } |
| 419 | } | 419 | } |
| 420 | } | 420 | } |
| @@ -1046,7 +1046,7 @@ redisplay_window (window, just_this_one) | |||
| 1046 | for (i = 0; i < height; i++) | 1046 | for (i = 0; i < height; i++) |
| 1047 | { | 1047 | { |
| 1048 | get_display_line (f, vpos + i, 0); | 1048 | get_display_line (f, vpos + i, 0); |
| 1049 | display_string (w, vpos + i, "", 0, 0, 0, 0, width); | 1049 | display_string (w, vpos + i, "", 0, 0, 0, 1, 0, width); |
| 1050 | } | 1050 | } |
| 1051 | 1051 | ||
| 1052 | goto finish_scroll_bars; | 1052 | goto finish_scroll_bars; |
| @@ -1823,60 +1823,64 @@ redisplay_region (buf, start, end) | |||
| 1823 | } | 1823 | } |
| 1824 | 1824 | ||
| 1825 | 1825 | ||
| 1826 | /* Copy glyphs from the vector FROM to the rope T. | 1826 | /* Copy LEN glyphs starting address FROM to the rope TO. |
| 1827 | But don't actually copy the parts that would come in before S. | 1827 | But don't actually copy the parts that would come in before S. |
| 1828 | Value is T, advanced past the copied data. */ | 1828 | Value is TO, advanced past the copied data. |
| 1829 | F is the frame we are displaying in. */ | ||
| 1829 | 1830 | ||
| 1830 | GLYPH * | 1831 | static GLYPH * |
| 1831 | copy_rope (t, s, from, face) | 1832 | copy_part_of_rope (f, to, s, from, len, face) |
| 1832 | register GLYPH *t; /* Copy to here. */ | 1833 | FRAME_PTR f; |
| 1834 | register GLYPH *to; /* Copy to here. */ | ||
| 1833 | register GLYPH *s; /* Starting point. */ | 1835 | register GLYPH *s; /* Starting point. */ |
| 1834 | Lisp_Object from; /* Data to copy; known to be a vector. */ | 1836 | Lisp_Object *from; /* Data to copy. */ |
| 1837 | int len; | ||
| 1835 | int face; /* Face to apply to glyphs which don't specify one. */ | 1838 | int face; /* Face to apply to glyphs which don't specify one. */ |
| 1836 | { | 1839 | { |
| 1837 | register int n = XVECTOR (from)->size; | 1840 | int n = len; |
| 1838 | register Lisp_Object *f = XVECTOR (from)->contents; | 1841 | register Lisp_Object *fp = from; |
| 1842 | /* These cache the results of the last call to compute_glyph_face. */ | ||
| 1843 | int last_code = -1; | ||
| 1844 | int last_merged = 0; | ||
| 1839 | 1845 | ||
| 1840 | while (n--) | 1846 | while (n--) |
| 1841 | { | 1847 | { |
| 1842 | int glyph = XFASTINT (*f); | 1848 | int glyph = XFASTINT (*fp); |
| 1849 | int facecode; | ||
| 1850 | |||
| 1851 | if (GLYPH_FACE (glyph) == 0) | ||
| 1852 | /* If GLYPH has no face code, use FACE. */ | ||
| 1853 | facecode = face; | ||
| 1854 | else if (GLYPH_FACE (glyph) == last_code) | ||
| 1855 | /* If it's same as previous glyph, use same result. */ | ||
| 1856 | facecode = last_merged; | ||
| 1857 | else | ||
| 1858 | { | ||
| 1859 | /* Merge this glyph's face and remember the result. */ | ||
| 1860 | last_code = GLYPH_FACE (glyph); | ||
| 1861 | last_merged = facecode = compute_glyph_face (f, last_code, face); | ||
| 1862 | } | ||
| 1843 | 1863 | ||
| 1844 | if (t >= s) *t = MAKE_GLYPH (GLYPH_CHAR (glyph), | 1864 | if (to >= s) *to = MAKE_GLYPH (GLYPH_CHAR (glyph), facecode); |
| 1845 | (GLYPH_FACE (glyph) | 1865 | ++to; |
| 1846 | ? GLYPH_FACE (glyph) | 1866 | ++fp; |
| 1847 | : face)); | ||
| 1848 | ++t; | ||
| 1849 | ++f; | ||
| 1850 | } | 1867 | } |
| 1851 | return t; | 1868 | return to; |
| 1852 | } | 1869 | } |
| 1853 | 1870 | ||
| 1854 | /* Copy exactly LEN glyphs from FROM into data at T. | 1871 | /* Correct a glyph by replacing its specified user-level face code |
| 1855 | But don't alter words before S. */ | 1872 | with a displayable computed face code. */ |
| 1856 | 1873 | ||
| 1857 | GLYPH * | 1874 | static GLYPH |
| 1858 | copy_part_of_rope (t, s, from, len, face) | 1875 | fix_glyph (f, glyph, current_face) |
| 1859 | register GLYPH *t; /* Copy to here. */ | 1876 | FRAME_PTR f; |
| 1860 | register GLYPH *s; /* Starting point. */ | 1877 | GLYPH glyph; |
| 1861 | Lisp_Object *from; /* Data to copy. */ | 1878 | int current_face; |
| 1862 | int len; | ||
| 1863 | int face; /* Face to apply to glyphs which don't specify one. */ | ||
| 1864 | { | 1879 | { |
| 1865 | int n = len; | 1880 | if (GLYPH_FACE (glyph) == 0) |
| 1866 | register Lisp_Object *f = from; | 1881 | return glyph; |
| 1867 | 1882 | return MAKE_GLYPH (GLYPH_CHAR (glyph), | |
| 1868 | while (n--) | 1883 | compute_glyph_face (f, GLYPH_FACE (glyph), current_face)); |
| 1869 | { | ||
| 1870 | int glyph = XFASTINT (*f); | ||
| 1871 | |||
| 1872 | if (t >= s) *t = MAKE_GLYPH (GLYPH_CHAR (glyph), | ||
| 1873 | (GLYPH_FACE (glyph) | ||
| 1874 | ? GLYPH_FACE (glyph) | ||
| 1875 | : face)); | ||
| 1876 | ++t; | ||
| 1877 | ++f; | ||
| 1878 | } | ||
| 1879 | return t; | ||
| 1880 | } | 1884 | } |
| 1881 | 1885 | ||
| 1882 | /* Display one line of window w, starting at position START in W's buffer. | 1886 | /* Display one line of window w, starting at position START in W's buffer. |
| @@ -1953,9 +1957,9 @@ display_text_line (w, start, vpos, hpos, taboffset) | |||
| 1953 | : default_invis_vector); | 1957 | : default_invis_vector); |
| 1954 | 1958 | ||
| 1955 | GLYPH truncator = (dp == 0 || XTYPE (DISP_TRUNC_GLYPH (dp)) != Lisp_Int | 1959 | GLYPH truncator = (dp == 0 || XTYPE (DISP_TRUNC_GLYPH (dp)) != Lisp_Int |
| 1956 | ? '$' : XINT (DISP_TRUNC_GLYPH (dp))); | 1960 | ? '$' : XINT (DISP_TRUNC_GLYPH (dp))); |
| 1957 | GLYPH continuer = (dp == 0 || XTYPE (DISP_CONTINUE_GLYPH (dp)) != Lisp_Int | 1961 | GLYPH continuer = (dp == 0 || XTYPE (DISP_CONTINUE_GLYPH (dp)) != Lisp_Int |
| 1958 | ? '\\' : XINT (DISP_CONTINUE_GLYPH (dp))); | 1962 | ? '\\' : XINT (DISP_CONTINUE_GLYPH (dp))); |
| 1959 | 1963 | ||
| 1960 | /* The next buffer location at which the face should change, due | 1964 | /* The next buffer location at which the face should change, due |
| 1961 | to overlays or text property changes. */ | 1965 | to overlays or text property changes. */ |
| @@ -2001,7 +2005,7 @@ display_text_line (w, start, vpos, hpos, taboffset) | |||
| 2001 | if (minibuf_prompt) | 2005 | if (minibuf_prompt) |
| 2002 | hpos = display_string (w, vpos, minibuf_prompt, -1, hpos, | 2006 | hpos = display_string (w, vpos, minibuf_prompt, -1, hpos, |
| 2003 | (!truncate ? continuer : truncator), | 2007 | (!truncate ? continuer : truncator), |
| 2004 | -1, -1); | 2008 | 1, -1, -1); |
| 2005 | minibuf_prompt_width = hpos; | 2009 | minibuf_prompt_width = hpos; |
| 2006 | } | 2010 | } |
| 2007 | 2011 | ||
| @@ -2130,7 +2134,7 @@ display_text_line (w, start, vpos, hpos, taboffset) | |||
| 2130 | p1 += selective_rlen; | 2134 | p1 += selective_rlen; |
| 2131 | if (p1 - startp > width) | 2135 | if (p1 - startp > width) |
| 2132 | p1 = endp; | 2136 | p1 = endp; |
| 2133 | copy_part_of_rope (p1prev, p1prev, invis_vector_contents, | 2137 | copy_part_of_rope (f, p1prev, p1prev, invis_vector_contents, |
| 2134 | (p1 - p1prev), current_face); | 2138 | (p1 - p1prev), current_face); |
| 2135 | } | 2139 | } |
| 2136 | #if 1 | 2140 | #if 1 |
| @@ -2163,7 +2167,7 @@ display_text_line (w, start, vpos, hpos, taboffset) | |||
| 2163 | p1 += selective_rlen; | 2167 | p1 += selective_rlen; |
| 2164 | if (p1 - startp > width) | 2168 | if (p1 - startp > width) |
| 2165 | p1 = endp; | 2169 | p1 = endp; |
| 2166 | copy_part_of_rope (p1prev, p1prev, invis_vector_contents, | 2170 | copy_part_of_rope (f, p1prev, p1prev, invis_vector_contents, |
| 2167 | (p1 - p1prev), current_face); | 2171 | (p1 - p1prev), current_face); |
| 2168 | } | 2172 | } |
| 2169 | #if 1 | 2173 | #if 1 |
| @@ -2177,14 +2181,17 @@ display_text_line (w, start, vpos, hpos, taboffset) | |||
| 2177 | } | 2181 | } |
| 2178 | else if (dp != 0 && XTYPE (DISP_CHAR_VECTOR (dp, c)) == Lisp_Vector) | 2182 | else if (dp != 0 && XTYPE (DISP_CHAR_VECTOR (dp, c)) == Lisp_Vector) |
| 2179 | { | 2183 | { |
| 2180 | p1 = copy_rope (p1, startp, DISP_CHAR_VECTOR (dp, c), current_face); | 2184 | p1 = copy_part_of_rope (f, p1, startp, |
| 2185 | XVECTOR (DISP_CHAR_VECTOR (dp, c))->contents, | ||
| 2186 | XVECTOR (DISP_CHAR_VECTOR (dp, c))->size, | ||
| 2187 | current_face); | ||
| 2181 | } | 2188 | } |
| 2182 | else if (c < 0200 && ctl_arrow) | 2189 | else if (c < 0200 && ctl_arrow) |
| 2183 | { | 2190 | { |
| 2184 | if (p1 >= startp) | 2191 | if (p1 >= startp) |
| 2185 | *p1 = MAKE_GLYPH ((dp && XTYPE (DISP_CTRL_GLYPH (dp)) == Lisp_Int | 2192 | *p1 = fix_glyph (f, (dp && XTYPE (DISP_CTRL_GLYPH (dp)) == Lisp_Int |
| 2186 | ? XINT (DISP_CTRL_GLYPH (dp)) : '^'), | 2193 | ? XINT (DISP_CTRL_GLYPH (dp)) : '^'), |
| 2187 | current_face); | 2194 | current_face); |
| 2188 | p1++; | 2195 | p1++; |
| 2189 | if (p1 >= startp && p1 < endp) | 2196 | if (p1 >= startp && p1 < endp) |
| 2190 | *p1 = MAKE_GLYPH (c ^ 0100, current_face); | 2197 | *p1 = MAKE_GLYPH (c ^ 0100, current_face); |
| @@ -2193,9 +2200,9 @@ display_text_line (w, start, vpos, hpos, taboffset) | |||
| 2193 | else | 2200 | else |
| 2194 | { | 2201 | { |
| 2195 | if (p1 >= startp) | 2202 | if (p1 >= startp) |
| 2196 | *p1 = MAKE_GLYPH ((dp && XTYPE (DISP_ESCAPE_GLYPH (dp)) == Lisp_Int | 2203 | *p1 = fix_glyph (f, (dp && XTYPE (DISP_ESCAPE_GLYPH (dp)) == Lisp_Int |
| 2197 | ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'), | 2204 | ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'), |
| 2198 | current_face); | 2205 | current_face); |
| 2199 | p1++; | 2206 | p1++; |
| 2200 | if (p1 >= startp && p1 < endp) | 2207 | if (p1 >= startp && p1 < endp) |
| 2201 | *p1 = MAKE_GLYPH ((c >> 6) + '0', current_face); | 2208 | *p1 = MAKE_GLYPH ((c >> 6) + '0', current_face); |
| @@ -2252,7 +2259,7 @@ display_text_line (w, start, vpos, hpos, taboffset) | |||
| 2252 | { | 2259 | { |
| 2253 | if (truncate) | 2260 | if (truncate) |
| 2254 | { | 2261 | { |
| 2255 | *p1++ = truncator; | 2262 | *p1++ = fix_glyph (f, truncator, 0); |
| 2256 | /* Truncating => start next line after next newline, | 2263 | /* Truncating => start next line after next newline, |
| 2257 | and point is on this line if it is before the newline, | 2264 | and point is on this line if it is before the newline, |
| 2258 | and skip none of first char of next line */ | 2265 | and skip none of first char of next line */ |
| @@ -2263,7 +2270,7 @@ display_text_line (w, start, vpos, hpos, taboffset) | |||
| 2263 | } | 2270 | } |
| 2264 | else | 2271 | else |
| 2265 | { | 2272 | { |
| 2266 | *p1++ = continuer; | 2273 | *p1++ = fix_glyph (f, continuer, 0); |
| 2267 | val.vpos = 0; | 2274 | val.vpos = 0; |
| 2268 | lastpos--; | 2275 | lastpos--; |
| 2269 | } | 2276 | } |
| @@ -2312,7 +2319,7 @@ display_text_line (w, start, vpos, hpos, taboffset) | |||
| 2312 | /* If hscroll and line not empty, insert truncation-at-left marker */ | 2319 | /* If hscroll and line not empty, insert truncation-at-left marker */ |
| 2313 | if (hscroll && lastpos != start) | 2320 | if (hscroll && lastpos != start) |
| 2314 | { | 2321 | { |
| 2315 | *startp = truncator; | 2322 | *startp = fix_glyph (f, truncator, 0); |
| 2316 | if (p1 <= startp) | 2323 | if (p1 <= startp) |
| 2317 | p1 = startp + 1; | 2324 | p1 = startp + 1; |
| 2318 | } | 2325 | } |
| @@ -2397,12 +2404,12 @@ display_menu_bar (w) | |||
| 2397 | hpos = display_string (XWINDOW (FRAME_ROOT_WINDOW (f)), vpos, | 2404 | hpos = display_string (XWINDOW (FRAME_ROOT_WINDOW (f)), vpos, |
| 2398 | XSTRING (string)->data, | 2405 | XSTRING (string)->data, |
| 2399 | XSTRING (string)->size, | 2406 | XSTRING (string)->size, |
| 2400 | hpos, 0, hpos, maxendcol); | 2407 | hpos, 0, 0, hpos, maxendcol); |
| 2401 | /* Put a gap of 3 spaces between items. */ | 2408 | /* Put a gap of 3 spaces between items. */ |
| 2402 | if (hpos < maxendcol) | 2409 | if (hpos < maxendcol) |
| 2403 | { | 2410 | { |
| 2404 | int hpos1 = hpos + 3; | 2411 | int hpos1 = hpos + 3; |
| 2405 | hpos = display_string (w, vpos, "", 0, hpos, 0, | 2412 | hpos = display_string (w, vpos, "", 0, hpos, 0, 0, |
| 2406 | min (hpos1, maxendcol), maxendcol); | 2413 | min (hpos1, maxendcol), maxendcol); |
| 2407 | } | 2414 | } |
| 2408 | } | 2415 | } |
| @@ -2412,7 +2419,7 @@ display_menu_bar (w) | |||
| 2412 | 2419 | ||
| 2413 | /* Fill out the line with spaces. */ | 2420 | /* Fill out the line with spaces. */ |
| 2414 | if (maxendcol > hpos) | 2421 | if (maxendcol > hpos) |
| 2415 | hpos = display_string (w, vpos, "", 0, hpos, 0, maxendcol, -1); | 2422 | hpos = display_string (w, vpos, "", 0, hpos, 0, 0, maxendcol, maxendcol); |
| 2416 | 2423 | ||
| 2417 | /* Clear the rest of the lines allocated to the menu bar. */ | 2424 | /* Clear the rest of the lines allocated to the menu bar. */ |
| 2418 | vpos++; | 2425 | vpos++; |
| @@ -2529,8 +2536,8 @@ display_mode_element (w, vpos, hpos, depth, minendcol, maxendcol, elt) | |||
| 2529 | if (this - 1 != last) | 2536 | if (this - 1 != last) |
| 2530 | { | 2537 | { |
| 2531 | register int lim = --this - last + hpos; | 2538 | register int lim = --this - last + hpos; |
| 2532 | hpos = display_string (w, vpos, last, -1, hpos, 0, hpos, | 2539 | hpos = display_string (w, vpos, last, -1, hpos, 0, 1, |
| 2533 | min (lim, maxendcol)); | 2540 | hpos, min (lim, maxendcol)); |
| 2534 | } | 2541 | } |
| 2535 | else /* c == '%' */ | 2542 | else /* c == '%' */ |
| 2536 | { | 2543 | { |
| @@ -2559,7 +2566,7 @@ display_mode_element (w, vpos, hpos, depth, minendcol, maxendcol, elt) | |||
| 2559 | decode_mode_spec (w, c, | 2566 | decode_mode_spec (w, c, |
| 2560 | maxendcol - hpos), | 2567 | maxendcol - hpos), |
| 2561 | -1, | 2568 | -1, |
| 2562 | hpos, 0, spec_width, maxendcol); | 2569 | hpos, 0, 1, spec_width, maxendcol); |
| 2563 | } | 2570 | } |
| 2564 | } | 2571 | } |
| 2565 | } | 2572 | } |
| @@ -2581,7 +2588,7 @@ display_mode_element (w, vpos, hpos, depth, minendcol, maxendcol, elt) | |||
| 2581 | if (XTYPE (tem) == Lisp_String) | 2588 | if (XTYPE (tem) == Lisp_String) |
| 2582 | hpos = display_string (w, vpos, XSTRING (tem)->data, | 2589 | hpos = display_string (w, vpos, XSTRING (tem)->data, |
| 2583 | XSTRING (tem)->size, | 2590 | XSTRING (tem)->size, |
| 2584 | hpos, 0, minendcol, maxendcol); | 2591 | hpos, 0, 1, minendcol, maxendcol); |
| 2585 | /* Give up right away for nil or t. */ | 2592 | /* Give up right away for nil or t. */ |
| 2586 | else if (!EQ (tem, elt)) | 2593 | else if (!EQ (tem, elt)) |
| 2587 | { elt = tem; goto tail_recurse; } | 2594 | { elt = tem; goto tail_recurse; } |
| @@ -2670,13 +2677,13 @@ display_mode_element (w, vpos, hpos, depth, minendcol, maxendcol, elt) | |||
| 2670 | 2677 | ||
| 2671 | default: | 2678 | default: |
| 2672 | invalid: | 2679 | invalid: |
| 2673 | return (display_string (w, vpos, "*invalid*", -1, hpos, 0, | 2680 | return (display_string (w, vpos, "*invalid*", -1, hpos, 0, 1, |
| 2674 | minendcol, maxendcol)); | 2681 | minendcol, maxendcol)); |
| 2675 | } | 2682 | } |
| 2676 | 2683 | ||
| 2677 | end: | 2684 | end: |
| 2678 | if (minendcol > hpos) | 2685 | if (minendcol > hpos) |
| 2679 | hpos = display_string (w, vpos, "", 0, hpos, 0, minendcol, -1); | 2686 | hpos = display_string (w, vpos, "", 0, hpos, 0, 1, minendcol, maxendcol); |
| 2680 | return hpos; | 2687 | return hpos; |
| 2681 | } | 2688 | } |
| 2682 | 2689 | ||
| @@ -2950,7 +2957,7 @@ display_count_lines (from, limit, n, pos_ptr) | |||
| 2950 | else | 2957 | else |
| 2951 | ZV = limit; | 2958 | ZV = limit; |
| 2952 | 2959 | ||
| 2953 | *pos_ptr = scan_buffer ('\n', from, n, &shortage); | 2960 | *pos_ptr = scan_buffer ('\n', from, n, &shortage, 0); |
| 2954 | 2961 | ||
| 2955 | ZV = oldzv; | 2962 | ZV = oldzv; |
| 2956 | BEGV = oldbegv; | 2963 | BEGV = oldbegv; |
| @@ -2976,15 +2983,22 @@ display_count_lines (from, limit, n, pos_ptr) | |||
| 2976 | The right edge of W is an implicit maximum. | 2983 | The right edge of W is an implicit maximum. |
| 2977 | If TRUNCATE is nonzero, the implicit maximum is one column before the edge. | 2984 | If TRUNCATE is nonzero, the implicit maximum is one column before the edge. |
| 2978 | 2985 | ||
| 2979 | Returns ending hpos */ | 2986 | OBEY_WINDOW_WIDTH says to put spaces or vertical bars |
| 2987 | at the place where the current window ends in this line | ||
| 2988 | and not display anything beyond there. Otherwise, only MAXCOL | ||
| 2989 | controls where to stop output. | ||
| 2990 | |||
| 2991 | Returns ending hpos. */ | ||
| 2980 | 2992 | ||
| 2981 | static int | 2993 | static int |
| 2982 | display_string (w, vpos, string, length, hpos, truncate, mincol, maxcol) | 2994 | display_string (w, vpos, string, length, hpos, truncate, |
| 2995 | obey_window_width, mincol, maxcol) | ||
| 2983 | struct window *w; | 2996 | struct window *w; |
| 2984 | unsigned char *string; | 2997 | unsigned char *string; |
| 2985 | int length; | 2998 | int length; |
| 2986 | int vpos, hpos; | 2999 | int vpos, hpos; |
| 2987 | GLYPH truncate; | 3000 | GLYPH truncate; |
| 3001 | int obey_window_width; | ||
| 2988 | int mincol, maxcol; | 3002 | int mincol, maxcol; |
| 2989 | { | 3003 | { |
| 2990 | register int c; | 3004 | register int c; |
| @@ -3010,23 +3024,29 @@ display_string (w, vpos, string, length, hpos, truncate, mincol, maxcol) | |||
| 3010 | 3024 | ||
| 3011 | p1 = p1start; | 3025 | p1 = p1start; |
| 3012 | start = desired_glyphs->glyphs[vpos] + XFASTINT (w->left); | 3026 | start = desired_glyphs->glyphs[vpos] + XFASTINT (w->left); |
| 3013 | end = start + window_width - (truncate != 0); | ||
| 3014 | 3027 | ||
| 3015 | if ((window_width + XFASTINT (w->left)) != FRAME_WIDTH (f)) | 3028 | if (obey_window_width) |
| 3016 | { | 3029 | { |
| 3017 | if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) | 3030 | end = start + window_width - (truncate != 0); |
| 3031 | |||
| 3032 | if ((window_width + XFASTINT (w->left)) != FRAME_WIDTH (f)) | ||
| 3018 | { | 3033 | { |
| 3019 | int i; | 3034 | if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
| 3035 | { | ||
| 3036 | int i; | ||
| 3020 | 3037 | ||
| 3021 | for (i = 0; i < VERTICAL_SCROLL_BAR_WIDTH; i++) | 3038 | for (i = 0; i < VERTICAL_SCROLL_BAR_WIDTH; i++) |
| 3022 | *end-- = ' '; | 3039 | *end-- = ' '; |
| 3040 | } | ||
| 3041 | else | ||
| 3042 | *end-- = '|'; | ||
| 3023 | } | 3043 | } |
| 3024 | else | ||
| 3025 | *end-- = '|'; | ||
| 3026 | } | 3044 | } |
| 3027 | 3045 | ||
| 3028 | if (maxcol >= 0 && end - desired_glyphs->glyphs[vpos] > maxcol) | 3046 | if (! obey_window_width |
| 3047 | || (maxcol >= 0 && end - desired_glyphs->glyphs[vpos] > maxcol)) | ||
| 3029 | end = desired_glyphs->glyphs[vpos] + maxcol; | 3048 | end = desired_glyphs->glyphs[vpos] + maxcol; |
| 3049 | |||
| 3030 | if (maxcol >= 0 && mincol > maxcol) | 3050 | if (maxcol >= 0 && mincol > maxcol) |
| 3031 | mincol = maxcol; | 3051 | mincol = maxcol; |
| 3032 | 3052 | ||
| @@ -3060,12 +3080,18 @@ display_string (w, vpos, string, length, hpos, truncate, mincol, maxcol) | |||
| 3060 | while ((p1 - start + hscroll - (hscroll > 0)) % tab_width); | 3080 | while ((p1 - start + hscroll - (hscroll > 0)) % tab_width); |
| 3061 | } | 3081 | } |
| 3062 | else if (dp != 0 && XTYPE (DISP_CHAR_VECTOR (dp, c)) == Lisp_Vector) | 3082 | else if (dp != 0 && XTYPE (DISP_CHAR_VECTOR (dp, c)) == Lisp_Vector) |
| 3063 | p1 = copy_rope (p1, start, DISP_CHAR_VECTOR (dp, c), 0); | 3083 | { |
| 3084 | p1 = copy_part_of_rope (f, p1, start, | ||
| 3085 | XVECTOR (DISP_CHAR_VECTOR (dp, c))->contents, | ||
| 3086 | XVECTOR (DISP_CHAR_VECTOR (dp, c))->size, | ||
| 3087 | 0); | ||
| 3088 | } | ||
| 3064 | else if (c < 0200 && ! NILP (buffer_defaults.ctl_arrow)) | 3089 | else if (c < 0200 && ! NILP (buffer_defaults.ctl_arrow)) |
| 3065 | { | 3090 | { |
| 3066 | if (p1 >= start) | 3091 | if (p1 >= start) |
| 3067 | *p1 = (dp && XTYPE (DISP_CTRL_GLYPH (dp)) == Lisp_Int | 3092 | *p1 = fix_glyph (f, (dp && XTYPE (DISP_CTRL_GLYPH (dp)) == Lisp_Int |
| 3068 | ? XINT (DISP_CTRL_GLYPH (dp)) : '^'); | 3093 | ? XINT (DISP_CTRL_GLYPH (dp)) : '^'), |
| 3094 | 0); | ||
| 3069 | p1++; | 3095 | p1++; |
| 3070 | if (p1 >= start && p1 < end) | 3096 | if (p1 >= start && p1 < end) |
| 3071 | *p1 = c ^ 0100; | 3097 | *p1 = c ^ 0100; |
| @@ -3074,8 +3100,9 @@ display_string (w, vpos, string, length, hpos, truncate, mincol, maxcol) | |||
| 3074 | else | 3100 | else |
| 3075 | { | 3101 | { |
| 3076 | if (p1 >= start) | 3102 | if (p1 >= start) |
| 3077 | *p1 = (dp && XTYPE (DISP_ESCAPE_GLYPH (dp)) == Lisp_Int | 3103 | *p1 = fix_glyph (f, (dp && XTYPE (DISP_ESCAPE_GLYPH (dp)) == Lisp_Int |
| 3078 | ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'); | 3104 | ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'), |
| 3105 | 0); | ||
| 3079 | p1++; | 3106 | p1++; |
| 3080 | if (p1 >= start && p1 < end) | 3107 | if (p1 >= start && p1 < end) |
| 3081 | *p1 = (c >> 6) + '0'; | 3108 | *p1 = (c >> 6) + '0'; |
| @@ -3092,7 +3119,7 @@ display_string (w, vpos, string, length, hpos, truncate, mincol, maxcol) | |||
| 3092 | if (c && length > 0) | 3119 | if (c && length > 0) |
| 3093 | { | 3120 | { |
| 3094 | p1 = end; | 3121 | p1 = end; |
| 3095 | if (truncate) *p1++ = truncate; | 3122 | if (truncate) *p1++ = fix_glyph (f, truncate, 0); |
| 3096 | } | 3123 | } |
| 3097 | else if (mincol >= 0) | 3124 | else if (mincol >= 0) |
| 3098 | { | 3125 | { |