ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/screen.C
(Generate patch)

Comparing rxvt-unicode/src/screen.C (file contents):
Revision 1.32 by pcg, Sun Feb 22 10:38:11 2004 UTC vs.
Revision 1.37 by pcg, Tue Feb 24 23:58:13 2004 UTC

862 scr_insdel_chars (1, INSERT); 862 scr_insdel_chars (1, INSERT);
863 863
864 if (charsets[screen.charset] == '0') // DEC SPECIAL 864 if (charsets[screen.charset] == '0') // DEC SPECIAL
865 switch (c) 865 switch (c)
866 { 866 {
867 // dunno where these come from
868#if 0
867 case '+': c = 0x2192; break; case ',': c = 0x2190; break; case '-': c = 0x2191; break; 869 case '+': c = 0x2192; break; case ',': c = 0x2190; break; case '-': c = 0x2191; break;
868 case '.': c = 0x2193; break; case '0': c = 0x25ae; break; case '`': c = 0x25c6; break; 870 case '.': c = 0x2193; break; case '0': c = 0x25ae; break;
871#endif
872 // vt100 special graphics and line drawing
873 case '`': c = 0x25c6; break; case '_': c = 0x0020; break;
869 case 'a': c = 0x2592; break; case 'f': c = 0x00b0; break; case 'g': c = 0x00b1; break; 874 case 'a': c = 0x2592; break; case 'b': c = 0x2409; break; case 'c': c = 0x240c; break;
870 case 'h': c = 0x2592; break; case 'i': c = 0x2603; break; case 'j': c = 0x2518; break;
871 case 'k': c = 0x2510; break; case 'l': c = 0x250c; break; case 'm': c = 0x2514; break; 875 case 'd': c = 0x240d; break; case 'e': c = 0x240a; break; case 'f': c = 0x00b0; break;
876 case 'g': c = 0x00b1; break; case 'h': c = 0x2424; break; case 'i': c = 0x240b; break;
872 case 'n': c = 0x253c; break; case 'o': c = 0x23ba; break; case 'p': c = 0x23bb; break; 877 case 'j': c = 0x2518; break; case 'k': c = 0x2510; break; case 'l': c = 0x250c; break;
873 case 'q': c = 0x2500; break; case 'r': c = 0x23bc; break; case 's': c = 0x23bd; break; 878 case 'm': c = 0x2514; break; case 'n': c = 0x253c; break; case 'o': c = 0x23ba; break;
874 case 't': c = 0x251c; break; case 'u': c = 0x2524; break; case 'v': c = 0x2534; break; 879 case 'p': c = 0x23bb; break; case 'q': c = 0x2500; break; case 'r': c = 0x23bc; break;
875 case 'w': c = 0x252c; break; case 'x': c = 0x2502; break; case 'y': c = 0x2264; break; 880 case 's': c = 0x23bd; break; case 't': c = 0x251c; break; case 'u': c = 0x2524; break;
876 case 'z': c = 0x2265; break; case '{': c = 0x03c0; break; case '|': c = 0x2260; break; 881 case 'v': c = 0x2534; break; case 'w': c = 0x252c; break; case 'x': c = 0x2502; break;
882 case 'y': c = 0x2264; break; case 'z': c = 0x2265; break; case '{': c = 0x03c0; break;
877 case '}': c = 0x00a3; break; case '~': c = 0x00b7; break; 883 case '|': c = 0x2260; break; case '}': c = 0x00a3; break; case '~': c = 0x00b7; break;
878 } 884 }
879 885
880 rend_t rend = SET_FONT (rstyle, TermWin.fontset->find_font (c)); 886 rend_t rend = SET_FONT (rstyle, TermWin.fontset->find_font (c));
881 // rely on wcwidth to tell us the character width, at least for non-ascii 887 // rely on wcwidth to tell us the character width, at least for non-ascii
882 int width = c <= 128 ? 1 : wcwidth (c); 888 int width = c <= 128 ? 1 : wcwidth (c);
1835 ((Y) >= (X)->min_char_or_byte2 && (Y) <= (X)->max_char_or_byte2) 1841 ((Y) >= (X)->min_char_or_byte2 && (Y) <= (X)->max_char_or_byte2)
1836 1842
1837void 1843void
1838rxvt_term::scr_refresh (unsigned char refresh_type) 1844rxvt_term::scr_refresh (unsigned char refresh_type)
1839{ 1845{
1840 unsigned char clearfirst, /* first character writes before cell */ 1846 unsigned char clearfirst, /* first character writes before cell */
1841 clearlast, /* last character writes beyond cell */ 1847 clearlast, /* last character writes beyond cell */
1842 must_clear, /* use draw_string not draw_image_string */ 1848 must_clear, /* use draw_string not draw_image_string */
1843 rvid, /* reverse video this position */ 1849 rvid, /* reverse video this position */
1844 showcursor; /* show the cursor */ 1850 showcursor; /* show the cursor */
1845 int16_t col, row, /* column/row we're processing */ 1851 int16_t col, row, /* column/row we're processing */
1846 ocrow; /* old cursor row */ 1852 ocrow; /* old cursor row */
1847 int cursorwidth;
1848 int i, /* tmp */ 1853 int i, /* tmp */
1849 row_offset; /* basic offset in screen structure */ 1854 row_offset; /* basic offset in screen structure */
1850#ifndef NO_CURSORCOLOR 1855#ifndef NO_CURSORCOLOR
1851 rend_t cc1; /* store colours at cursor position (s) */ 1856 rend_t cc1; /* store colours at cursor position (s) */
1852#endif 1857#endif
1853 rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */ 1858 rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */
1854 text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */ 1859 text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */
1855 1860
1856 if (refresh_type == NO_REFRESH || !TermWin.mapped) 1861 if (refresh_type == NO_REFRESH || !TermWin.mapped)
1857 return; 1862 return;
1858 1863
1859 /* 1864 /*
1891 unsigned char setoldcursor; 1896 unsigned char setoldcursor;
1892 rend_t ccol1, /* Cursor colour */ 1897 rend_t ccol1, /* Cursor colour */
1893 ccol2; /* Cursor colour2 */ 1898 ccol2; /* Cursor colour2 */
1894 1899
1895 showcursor = (screen.flags & Screen_VisibleCursor); 1900 showcursor = (screen.flags & Screen_VisibleCursor);
1896 cursorwidth = 0;
1897#ifdef CURSOR_BLINK 1901#ifdef CURSOR_BLINK
1898 if (hidden_cursor) 1902 if (hidden_cursor)
1899 showcursor = 0; 1903 showcursor = 0;
1900#endif 1904#endif
1901 1905
1902 cursorwidth = 0;
1903
1904 if (showcursor) 1906 if (showcursor)
1905 { 1907 {
1906 cursorwidth++;
1907
1908 srp = & (screen.rend[screen.cur.row + TermWin.saveLines] 1908 srp = & (screen.rend[screen.cur.row + TermWin.saveLines]
1909 [screen.cur.col]); 1909 [screen.cur.col]);
1910 1910
1911 if (showcursor && TermWin.focus) 1911 if (showcursor && TermWin.focus)
1912 { 1912 {
1930 ccol2 = Color_bg; 1930 ccol2 = Color_bg;
1931#endif 1931#endif
1932 *srp = SET_FGCOLOR (*srp, ccol1); 1932 *srp = SET_FGCOLOR (*srp, ccol1);
1933 *srp = SET_BGCOLOR (*srp, ccol2); 1933 *srp = SET_BGCOLOR (*srp, ccol2);
1934#endif 1934#endif
1935
1936 } 1935 }
1937 } 1936 }
1938 1937
1939 /* make sure no outline cursor is left around */ 1938 /* make sure no outline cursor is left around */
1940 setoldcursor = 0; 1939 setoldcursor = 0;
2121 int fore = GET_FGCOLOR (rend); // desired foreground 2120 int fore = GET_FGCOLOR (rend); // desired foreground
2122 int back = GET_BGCOLOR (rend); // desired background 2121 int back = GET_BGCOLOR (rend); // desired background
2123 2122
2124 rend = GET_ATTR (rend); 2123 rend = GET_ATTR (rend);
2125 2124
2126 rvid = !! (rend & RS_RVid); 2125 rvid = !!(rend & RS_RVid);
2126
2127#ifndef NO_BOLD_UNDERLINE_REVERSE
2128 if (rend & RS_Bold && fore == Color_fg)
2129 {
2130 if (ISSET_PIXCOLOR (Color_BD))
2131 fore = Color_BD;
2132 else
2133 rvid = !rvid;
2134 }
2135
2136 if (rend & RS_Uline)
2137 {
2138 if (ISSET_PIXCOLOR (Color_UL))
2139 fore = Color_UL;
2140 }
2141#endif
2142
2127 if (rvid) 2143 if (rvid)
2128 { 2144 {
2129 SWAP_IT (fore, back, int); 2145 SWAP_IT (fore, back, int);
2130 2146
2131#ifndef NO_BOLD_UNDERLINE_REVERSE 2147#ifndef NO_BOLD_UNDERLINE_REVERSE
2134 && !ISSET_PIXCOLOR (Color_cursor) 2150 && !ISSET_PIXCOLOR (Color_cursor)
2135# endif 2151# endif
2136 ) 2152 )
2137 back = Color_RV; 2153 back = Color_RV;
2138#endif 2154#endif
2139
2140 } 2155 }
2156
2141#ifdef TEXT_BLINK 2157#ifdef TEXT_BLINK
2142 if (rend & RS_Blink) 2158 if (rend & RS_Blink)
2143 { 2159 {
2144 if (!text_blink_ev.active) 2160 if (!text_blink_ev.active)
2145 { 2161 {
2148 } 2164 }
2149 else if (hidden_text) 2165 else if (hidden_text)
2150 fore = back; 2166 fore = back;
2151 } 2167 }
2152#endif 2168#endif
2153#ifndef NO_BOLD_UNDERLINE_REVERSE
2154 else if (rend & RS_Bold)
2155 {
2156 if (ISSET_PIXCOLOR (Color_BD))
2157 fore = Color_BD;
2158 else if (fore == Color_fg)
2159 fore = Color_White;
2160 }
2161 else if (rend & RS_Uline)
2162 {
2163 if (ISSET_PIXCOLOR (Color_UL))
2164 fore = Color_UL;
2165 }
2166#endif
2167 2169
2168 /* 2170 /*
2169 * Actually do the drawing of the string here 2171 * Actually do the drawing of the string here
2170 */ 2172 */
2171 rxvt_font *font = (*TermWin.fontset)[fid]; 2173 rxvt_font *font = (*TermWin.fontset)[fid];
2172 2174
2173 if (back == fore) 2175 if (back == fore)
2174 font->clear_rect (xpixel, ypixel, 2176 font->clear_rect (*TermWin.drawable, xpixel, ypixel,
2175 TermWin.fwidth * count, TermWin.fheight, 2177 TermWin.fwidth * count, TermWin.fheight,
2176 back); 2178 back);
2177 else if (back == Color_bg) 2179 else if (back == Color_bg)
2178 { 2180 {
2179 if (must_clear) 2181 if (must_clear)
2181 CLEAR_CHARS (xpixel, ypixel, count); 2183 CLEAR_CHARS (xpixel, ypixel, count);
2182 2184
2183 for (i = 0; i < count; i++) /* don't draw empty strings */ 2185 for (i = 0; i < count; i++) /* don't draw empty strings */
2184 if (text[i] != ' ') 2186 if (text[i] != ' ')
2185 { 2187 {
2186 font->draw (xpixel, ypixel, text, count, fore, -1); 2188 font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, -1);
2187 break; 2189 break;
2188 } 2190 }
2189 } 2191 }
2190 else 2192 else
2191 font->draw (xpixel, ypixel, text, count, fore, Color_bg); 2193 font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, Color_bg);
2192 } 2194 }
2193 else 2195 else
2194 font->draw (xpixel, ypixel, text, count, fore, back); 2196 font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, back);
2195 2197
2196 if ((rend & RS_Uline) && (font->descent > 1)) 2198 if ((rend & RS_Uline) && (font->descent > 1))
2197 XDrawLine (display->display, drawBuffer, TermWin.gc, 2199 XDrawLine (display->display, drawBuffer, TermWin.gc,
2198 xpixel, ypixel + font->ascent + 1, 2200 xpixel, ypixel + font->ascent + 1,
2199 xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); 2201 xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1);
2211 [screen.cur.col]); 2213 [screen.cur.col]);
2212 *srp ^= RS_RVid; 2214 *srp ^= RS_RVid;
2213#ifndef NO_CURSORCOLOR 2215#ifndef NO_CURSORCOLOR
2214 *srp = (*srp & ~ (RS_fgMask | RS_bgMask)) | cc1; 2216 *srp = (*srp & ~ (RS_fgMask | RS_bgMask)) | cc1;
2215#endif 2217#endif
2216
2217 } 2218 }
2218 else if (oldcursor.row >= 0) 2219 else if (oldcursor.row >= 0)
2219 { 2220 {
2220#ifndef NO_CURSORCOLOR 2221#ifndef NO_CURSORCOLOR
2221 if (ISSET_PIXCOLOR (Color_cursor)) 2222 if (ISSET_PIXCOLOR (Color_cursor))
2222 XSetForeground (display->display, TermWin.gc, PixColors[Color_cursor]); 2223 XSetForeground (display->display, TermWin.gc, PixColors[Color_cursor]);
2223#endif 2224#endif
2225 int cursorwidth = 1;
2226 while (oldcursor.col + cursorwidth < TermWin.ncol
2227 && drawn_text[oldcursor.row][oldcursor.col + cursorwidth] == NOCHAR)
2228 cursorwidth++;
2229
2224 XDrawRectangle (display->display, drawBuffer, TermWin.gc, 2230 XDrawRectangle (display->display, drawBuffer, TermWin.gc,
2225 Col2Pixel (oldcursor.col), 2231 Col2Pixel (oldcursor.col),
2226 Row2Pixel (oldcursor.row), 2232 Row2Pixel (oldcursor.row),
2227 (unsigned int) (Width2Pixel (cursorwidth) - 1), 2233 (unsigned int) (Width2Pixel (cursorwidth) - 1),
2228 (unsigned int) (Height2Pixel (1) - TermWin.lineSpace - 1)); 2234 (unsigned int) (Height2Pixel (1) - TermWin.lineSpace - 1));
2690rxvt_term::selection_clear () 2696rxvt_term::selection_clear ()
2691{ 2697{
2692 D_SELECT ((stderr, "rxvt_selection_clear ()")); 2698 D_SELECT ((stderr, "rxvt_selection_clear ()"));
2693 2699
2694 want_refresh = 1; 2700 want_refresh = 1;
2695 if (selection.text)
2696 free (selection.text); 2701 free (selection.text);
2697 selection.text = NULL; 2702 selection.text = NULL;
2698 selection.len = 0; 2703 selection.len = 0;
2699 CLEAR_SELECTION (); 2704 CLEAR_SELECTION ();
2700} 2705}
2701 2706

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines