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.309 by root, Mon Jul 21 16:51:31 2008 UTC vs.
Revision 1.313 by root, Tue Nov 4 14:25:10 2008 UTC

132 132
133 l.l = 0; 133 l.l = 0;
134 l.f = 0; 134 l.f = 0;
135} 135}
136 136
137// nuke a single wide character at the given column
138void
139rxvt_term::scr_kill_char (line_t &l, int col) const NOTHROW
140{
141 // find begin
142 while (col > 0 && l.t[col] == NOCHAR)
143 col--;
144
145 rend_t rend = l.r[col] & ~RS_baseattrMask;
146 rend = SET_FONT (rend, FONTSET (rend)->find_font (' '));
147
148 // found begin, nuke
149 do {
150 l.t[col] = ' ';
151 l.r[col] = rend;
152 col++;
153 } while (col < ncol && l.t[col] == NOCHAR);
154}
155
137/* ------------------------------------------------------------------------- * 156/* ------------------------------------------------------------------------- *
138 * SCREEN INITIALISATION * 157 * SCREEN INITIALISATION *
139 * ------------------------------------------------------------------------- */ 158 * ------------------------------------------------------------------------- */
140 159
141void 160void
880 if (expect_false ( 899 if (expect_false (
881 line->t[screen.cur.col] == NOCHAR 900 line->t[screen.cur.col] == NOCHAR
882 || (screen.cur.col < ncol - 1 901 || (screen.cur.col < ncol - 1
883 && line->t[screen.cur.col + 1] == NOCHAR) 902 && line->t[screen.cur.col + 1] == NOCHAR)
884 )) 903 ))
885 { 904 scr_kill_char (*line, screen.cur.col);
886 int col = screen.cur.col;
887
888 // find begin
889 while (col > 0 && line->t[col] == NOCHAR)
890 col--;
891
892 rend_t rend = SET_FONT (line->r[col], FONTSET (line->r[col])->find_font (' '));
893
894 // found begin, nuke
895 do {
896 line->t[col] = ' ';
897 line->r[col] = rend;
898 col++;
899 } while (col < ncol && line->t[col] == NOCHAR);
900 }
901 905
902 rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c)); 906 rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c));
903 907
904 // if the character doesn't fit into the remaining columns... 908 // if the character doesn't fit into the remaining columns...
905 if (expect_false (screen.cur.col > ncol - width && ncol >= width)) 909 if (expect_false (screen.cur.col > ncol - width && ncol >= width))
1497 case ERASE: 1501 case ERASE:
1498 screen.cur.col += count; /* don't worry if > ncol */ 1502 screen.cur.col += count; /* don't worry if > ncol */
1499 selection_check (1); 1503 selection_check (1);
1500 screen.cur.col -= count; 1504 screen.cur.col -= count;
1501 1505
1502 line->l = max (line->l - count, 0);
1503 scr_blank_line (*line, screen.cur.col, count, rstyle); 1506 scr_blank_line (*line, screen.cur.col, count, rstyle);
1504 break; 1507 break;
1505 1508
1506 case DELETE: 1509 case DELETE:
1507 tr = line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask); 1510 tr = line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask);
1899 XMapWindow (dpy, parent[0]); 1902 XMapWindow (dpy, parent[0]);
1900# endif 1903# endif
1901 1904
1902# if ENABLE_FRILLS 1905# if ENABLE_FRILLS
1903 if (option (Opt_urgentOnBell)) 1906 if (option (Opt_urgentOnBell))
1904 { 1907 set_urgency (1);
1905 if (XWMHints *h = XGetWMHints(dpy, parent[0]))
1906 {
1907 h->flags |= XUrgencyHint;
1908 XSetWMHints (dpy, parent[0], h);
1909 }
1910 }
1911# endif 1908# endif
1912 1909
1913 if (option (Opt_visualBell)) 1910 if (option (Opt_visualBell))
1914 { 1911 {
1915 rvideo_bell = true; 1912 rvideo_bell = true;
2210 continue; 2207 continue;
2211 2208
2212 // redraw one or more characters 2209 // redraw one or more characters
2213 2210
2214 // seek to the beginning of wide characters 2211 // seek to the beginning of wide characters
2215 while (stp[col] == NOCHAR && col > 0) 2212 while (expect_false (stp[col] == NOCHAR && col > 0))
2216 --col; 2213 --col;
2217 2214
2218 rend_t rend = srp[col]; /* screen rendition (target rendtion) */ 2215 rend_t rend = srp[col]; /* screen rendition (target rendtion) */
2219 text_t *text = stp + col; 2216 text_t *text = stp + col;
2220 int count = 1; 2217 int count = 1;
2257 2254
2258 col--; /* went one too far. move back */ 2255 col--; /* went one too far. move back */
2259 count -= i; /* dump any matching trailing chars */ 2256 count -= i; /* dump any matching trailing chars */
2260 2257
2261 // sometimes we optimize away the trailing NOCHAR's, add them back 2258 // sometimes we optimize away the trailing NOCHAR's, add them back
2262 while (i && text[count] == NOCHAR) 2259 while (expect_false (i && text[count] == NOCHAR))
2263 count++, i--; 2260 count++, i--;
2264 2261
2265 /* 2262 /*
2266 * Determine the attributes for the string 2263 * Determine the attributes for the string
2267 */ 2264 */
2268 int fore = fgcolor_of (rend); // desired foreground 2265 int fore = fgcolor_of (rend); // desired foreground
2269 int back = bgcolor_of (rend); // desired background 2266 int back = bgcolor_of (rend); // desired background
2270 2267
2271 // only do special processing if any attributes are set, which is unlikely 2268 // only do special processing if any attributes are set, which is unlikely
2272 if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)) 2269 if (expect_false (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)))
2273 { 2270 {
2274 bool invert = rend & RS_RVid; 2271 bool invert = rend & RS_RVid;
2275 2272
2276#ifndef NO_BOLD_UNDERLINE_REVERSE 2273#ifndef NO_BOLD_UNDERLINE_REVERSE
2277 if (rend & RS_Bold && fore == Color_fg) 2274 if (rend & RS_Bold && fore == Color_fg)
2360 /* 2357 /*
2361 * Actually do the drawing of the string here 2358 * Actually do the drawing of the string here
2362 */ 2359 */
2363 rxvt_font *font = (*fontset[GET_STYLE (rend)])[GET_FONT (rend)]; 2360 rxvt_font *font = (*fontset[GET_STYLE (rend)])[GET_FONT (rend)];
2364 2361
2365 if (have_bg && back == Color_bg) 2362 if (expect_true (have_bg && back == Color_bg))
2366 { 2363 {
2367 // this is very ugly, maybe push it into ->draw? 2364 // this is very ugly, maybe push it into ->draw?
2368 2365
2369 for (i = 0; i < count; i++) /* don't draw empty strings */ 2366 for (i = 0; i < count; i++) /* don't draw empty strings */
2370 if (text[i] != ' ') 2367 if (text[i] != ' ')
2377 did_clear: ; 2374 did_clear: ;
2378 } 2375 }
2379 else 2376 else
2380 font->draw (*drawable, xpixel, ypixel, text, count, fore, back); 2377 font->draw (*drawable, xpixel, ypixel, text, count, fore, back);
2381 2378
2382 if (rend & RS_Uline && font->descent > 1 && fore != back) 2379 if (expect_false (rend & RS_Uline && font->descent > 1 && fore != back))
2383 { 2380 {
2384#if ENABLE_FRILLS 2381#if ENABLE_FRILLS
2385 if (ISSET_PIXCOLOR (Color_underline)) 2382 if (ISSET_PIXCOLOR (Color_underline))
2386 XSetForeground (dpy, gc, pix_colors[Color_underline]); 2383 XSetForeground (dpy, gc, pix_colors[Color_underline]);
2387 else 2384 else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines