comparison src/xdisp.c @ 6415:35917d3d0952

(fix_glyph, display_text_line, copy_part_of_rope, display_mode_line): Handle termcap frames as well as X.
author Karl Heuer <kwzh@gnu.org>
date Sat, 19 Mar 1994 02:53:33 +0000
parents 89fdd37c2397
children 07ecb7a5c916
comparison
equal deleted inserted replaced
6414:d681b16231a8 6415:35917d3d0952
1835 register Lisp_Object *fp = from; 1835 register Lisp_Object *fp = from;
1836 /* These cache the results of the last call to compute_glyph_face. */ 1836 /* These cache the results of the last call to compute_glyph_face. */
1837 int last_code = -1; 1837 int last_code = -1;
1838 int last_merged = 0; 1838 int last_merged = 0;
1839 1839
1840 while (n--) 1840 #ifdef HAVE_X_WINDOWS
1841 { 1841 if (! FRAME_TERMCAP_P (f))
1842 int glyph = XFASTINT (*fp); 1842 while (n--)
1843 int facecode; 1843 {
1844 1844 int glyph = XFASTINT (*fp);
1845 if (GLYPH_FACE (glyph) == 0) 1845 int facecode;
1846 /* If GLYPH has no face code, use FACE. */ 1846
1847 facecode = face; 1847 if (FAST_GLYPH_FACE (glyph) == 0)
1848 else if (GLYPH_FACE (glyph) == last_code) 1848 /* If GLYPH has no face code, use FACE. */
1849 /* If it's same as previous glyph, use same result. */ 1849 facecode = face;
1850 facecode = last_merged; 1850 else if (FAST_GLYPH_FACE (glyph) == last_code)
1851 else 1851 /* If it's same as previous glyph, use same result. */
1852 { 1852 facecode = last_merged;
1853 /* Merge this glyph's face and remember the result. */ 1853 else
1854 last_code = GLYPH_FACE (glyph); 1854 {
1855 last_merged = facecode = compute_glyph_face (f, last_code, face); 1855 /* Merge this glyph's face and remember the result. */
1856 } 1856 last_code = FAST_GLYPH_FACE (glyph);
1857 1857 last_merged = facecode = compute_glyph_face (f, last_code, face);
1858 if (to >= s) *to = MAKE_GLYPH (GLYPH_CHAR (glyph), facecode); 1858 }
1859 ++to; 1859
1860 ++fp; 1860 if (to >= s)
1861 } 1861 *to = FAST_MAKE_GLYPH (FAST_GLYPH_CHAR (glyph), facecode);
1862 ++to;
1863 ++fp;
1864 }
1865 else
1866 #endif
1867 while (n--)
1868 {
1869 if (to >= s) *to = XFASTINT (*fp);
1870 ++to;
1871 ++fp;
1872 }
1862 return to; 1873 return to;
1863 } 1874 }
1864 1875
1865 /* Correct a glyph by replacing its specified user-level face code 1876 /* Correct a glyph by replacing its specified user-level face code
1866 with a displayable computed face code. */ 1877 with a displayable computed face code. */
1869 fix_glyph (f, glyph, current_face) 1880 fix_glyph (f, glyph, current_face)
1870 FRAME_PTR f; 1881 FRAME_PTR f;
1871 GLYPH glyph; 1882 GLYPH glyph;
1872 int current_face; 1883 int current_face;
1873 { 1884 {
1874 if (GLYPH_FACE (glyph) == 0) 1885 #ifdef HAVE_X_WINDOWS
1875 return glyph; 1886 if (! FRAME_TERMCAP_P (f) && FAST_GLYPH_FACE (glyph) != 0)
1876 return MAKE_GLYPH (GLYPH_CHAR (glyph), 1887 return FAST_MAKE_GLYPH (FAST_GLYPH_CHAR (glyph),
1877 compute_glyph_face (f, GLYPH_FACE (glyph), current_face)); 1888 compute_glyph_face (f, FAST_GLYPH_FACE (glyph),
1889 current_face));
1890 #endif
1891 return glyph;
1878 } 1892 }
1879 1893
1880 /* Display one line of window w, starting at position START in W's buffer. 1894 /* Display one line of window w, starting at position START in W's buffer.
1881 Display starting at horizontal position HPOS, which is normally zero 1895 Display starting at horizontal position HPOS, which is normally zero
1882 or negative. A negative value causes output up to hpos = 0 to be discarded. 1896 or negative. A negative value causes output up to hpos = 0 to be discarded.
2107 c = *p++; 2121 c = *p++;
2108 if (c >= 040 && c < 0177 2122 if (c >= 040 && c < 0177
2109 && (dp == 0 || XTYPE (DISP_CHAR_VECTOR (dp, c)) != Lisp_Vector)) 2123 && (dp == 0 || XTYPE (DISP_CHAR_VECTOR (dp, c)) != Lisp_Vector))
2110 { 2124 {
2111 if (p1 >= startp) 2125 if (p1 >= startp)
2112 *p1 = MAKE_GLYPH (c, current_face); 2126 *p1 = MAKE_GLYPH (f, c, current_face);
2113 p1++; 2127 p1++;
2114 } 2128 }
2115 else if (c == '\n') 2129 else if (c == '\n')
2116 { 2130 {
2117 invis = 0; 2131 invis = 0;
2130 if (p1 - startp > width) 2144 if (p1 - startp > width)
2131 p1 = endp; 2145 p1 = endp;
2132 copy_part_of_rope (f, p1prev, p1prev, invis_vector_contents, 2146 copy_part_of_rope (f, p1prev, p1prev, invis_vector_contents,
2133 (p1 - p1prev), current_face); 2147 (p1 - p1prev), current_face);
2134 } 2148 }
2135 #if 1 2149 #ifdef HAVE_X_WINDOWS
2136 /* Draw the face of the newline character as extending all the 2150 /* Draw the face of the newline character as extending all the
2137 way to the end of the frame line. */ 2151 way to the end of the frame line. */
2138 if (current_face) 2152 if (current_face)
2139 while (p1 < endp) 2153 while (p1 < endp)
2140 *p1++ = MAKE_GLYPH (' ', current_face); 2154 *p1++ = FAST_MAKE_GLYPH (' ', current_face);
2141 #endif 2155 #endif
2142 break; 2156 break;
2143 } 2157 }
2144 else if (c == '\t') 2158 else if (c == '\t')
2145 { 2159 {
2146 do 2160 do
2147 { 2161 {
2148 if (p1 >= startp && p1 < endp) 2162 if (p1 >= startp && p1 < endp)
2149 *p1 = MAKE_GLYPH (' ', current_face); 2163 *p1 = MAKE_GLYPH (f, ' ', current_face);
2150 p1++; 2164 p1++;
2151 } 2165 }
2152 while ((p1 - startp + taboffset + hscroll - (hscroll > 0)) 2166 while ((p1 - startp + taboffset + hscroll - (hscroll > 0))
2153 % tab_width); 2167 % tab_width);
2154 } 2168 }
2163 if (p1 - startp > width) 2177 if (p1 - startp > width)
2164 p1 = endp; 2178 p1 = endp;
2165 copy_part_of_rope (f, p1prev, p1prev, invis_vector_contents, 2179 copy_part_of_rope (f, p1prev, p1prev, invis_vector_contents,
2166 (p1 - p1prev), current_face); 2180 (p1 - p1prev), current_face);
2167 } 2181 }
2168 #if 1 2182 #ifdef HAVE_X_WINDOWS
2169 /* Draw the face of the newline character as extending all the 2183 /* Draw the face of the newline character as extending all the
2170 way to the end of the frame line. */ 2184 way to the end of the frame line. */
2171 if (current_face) 2185 if (current_face)
2172 while (p1 < endp) 2186 while (p1 < endp)
2173 *p1++ = MAKE_GLYPH (' ', current_face); 2187 *p1++ = FAST_MAKE_GLYPH (' ', current_face);
2174 #endif 2188 #endif
2175 break; 2189 break;
2176 } 2190 }
2177 else if (dp != 0 && XTYPE (DISP_CHAR_VECTOR (dp, c)) == Lisp_Vector) 2191 else if (dp != 0 && XTYPE (DISP_CHAR_VECTOR (dp, c)) == Lisp_Vector)
2178 { 2192 {
2187 *p1 = fix_glyph (f, (dp && XTYPE (DISP_CTRL_GLYPH (dp)) == Lisp_Int 2201 *p1 = fix_glyph (f, (dp && XTYPE (DISP_CTRL_GLYPH (dp)) == Lisp_Int
2188 ? XINT (DISP_CTRL_GLYPH (dp)) : '^'), 2202 ? XINT (DISP_CTRL_GLYPH (dp)) : '^'),
2189 current_face); 2203 current_face);
2190 p1++; 2204 p1++;
2191 if (p1 >= startp && p1 < endp) 2205 if (p1 >= startp && p1 < endp)
2192 *p1 = MAKE_GLYPH (c ^ 0100, current_face); 2206 *p1 = MAKE_GLYPH (f, c ^ 0100, current_face);
2193 p1++; 2207 p1++;
2194 } 2208 }
2195 else 2209 else
2196 { 2210 {
2197 if (p1 >= startp) 2211 if (p1 >= startp)
2198 *p1 = fix_glyph (f, (dp && XTYPE (DISP_ESCAPE_GLYPH (dp)) == Lisp_Int 2212 *p1 = fix_glyph (f, (dp && XTYPE (DISP_ESCAPE_GLYPH (dp)) == Lisp_Int
2199 ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'), 2213 ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'),
2200 current_face); 2214 current_face);
2201 p1++; 2215 p1++;
2202 if (p1 >= startp && p1 < endp) 2216 if (p1 >= startp && p1 < endp)
2203 *p1 = MAKE_GLYPH ((c >> 6) + '0', current_face); 2217 *p1 = MAKE_GLYPH (f, (c >> 6) + '0', current_face);
2204 p1++; 2218 p1++;
2205 if (p1 >= startp && p1 < endp) 2219 if (p1 >= startp && p1 < endp)
2206 *p1 = MAKE_GLYPH ((7 & (c >> 3)) + '0', current_face); 2220 *p1 = MAKE_GLYPH (f, (7 & (c >> 3)) + '0', current_face);
2207 p1++; 2221 p1++;
2208 if (p1 >= startp && p1 < endp) 2222 if (p1 >= startp && p1 < endp)
2209 *p1 = MAKE_GLYPH ((7 & c) + '0', current_face); 2223 *p1 = MAKE_GLYPH (f, (7 & c) + '0', current_face);
2210 p1++; 2224 p1++;
2211 } 2225 }
2212 2226
2213 pos++; 2227 pos++;
2214 } 2228 }
2450 (which implies that that window is split side-by-side 2464 (which implies that that window is split side-by-side
2451 and the rest of this line is mode lines of the sibling windows). */ 2465 and the rest of this line is mode lines of the sibling windows). */
2452 if (XFASTINT (w->width) == FRAME_WIDTH (f) 2466 if (XFASTINT (w->width) == FRAME_WIDTH (f)
2453 || XFASTINT (XWINDOW (w->parent)->width) == FRAME_WIDTH (f)) 2467 || XFASTINT (XWINDOW (w->parent)->width) == FRAME_WIDTH (f))
2454 FRAME_DESIRED_GLYPHS (f)->highlight[vpos] = mode_line_inverse_video; 2468 FRAME_DESIRED_GLYPHS (f)->highlight[vpos] = mode_line_inverse_video;
2469 #ifdef HAVE_X_WINDOWS
2455 else if (! FRAME_TERMCAP_P (f)) 2470 else if (! FRAME_TERMCAP_P (f))
2456 { 2471 {
2457 /* For a partial width window, explicitly set face of each glyph. */ 2472 /* For a partial width window, explicitly set face of each glyph. */
2458 int i; 2473 int i;
2459 GLYPH *ptr = FRAME_DESIRED_GLYPHS (f)->glyphs[vpos]; 2474 GLYPH *ptr = FRAME_DESIRED_GLYPHS (f)->glyphs[vpos];
2460 for (i = left; i < right; ++i) 2475 for (i = left; i < right; ++i)
2461 ptr[i] = MAKE_GLYPH (GLYPH_CHAR (ptr[i]), 1); 2476 ptr[i] = FAST_MAKE_GLYPH (FAST_GLYPH_CHAR (ptr[i]), 1);
2462 } 2477 }
2478 #endif
2463 2479
2464 #ifdef HAVE_X_WINDOWS 2480 #ifdef HAVE_X_WINDOWS
2465 if (w == XWINDOW (f->selected_window)) 2481 if (w == XWINDOW (f->selected_window))
2466 x_consider_frame_title (WINDOW_FRAME (w)); 2482 x_consider_frame_title (WINDOW_FRAME (w));
2467 #endif 2483 #endif