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.30 by pcg, Fri Feb 13 12:16:21 2004 UTC vs.
Revision 1.41 by pcg, Sun Feb 29 15:31:56 2004 UTC

1/*--------------------------------*-C-*--------------------------------------* 1/*--------------------------------*-C-*--------------------------------------*
2 * File: screen.c 2 * File: screen.c
3 *---------------------------------------------------------------------------* 3 *---------------------------------------------------------------------------*
4 * 4 *
5 * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> 5 * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com>
6 * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com>
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version. 11 * (at your option) any later version.
16 * 17 *
17 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *--------------------------------------------------------------------------*/ 21 *--------------------------------------------------------------------------*/
22
21/* 23/*
22 * We handle _all_ screen updates and selections 24 * This file handles _all_ screen updates and selections
23 */ 25 */
24 26
25#include "../config.h" /* NECESSARY */ 27#include "../config.h" /* NECESSARY */
26#define INTERN_SCREEN 28#define INTERN_SCREEN
27#include "rxvt.h" /* NECESSARY */ 29#include "rxvt.h" /* NECESSARY */
30#include <X11/Xmd.h> /* get the typedef for CARD32 */ 32#include <X11/Xmd.h> /* get the typedef for CARD32 */
31 33
32#include <stdint.h> 34#include <stdint.h>
33#include <wchar.h> 35#include <wchar.h>
34 36
35#include "salloc.C" // HACK!! 37#include "salloc.C" // HACK, should be a seperate compile!
36 38
37inline void fill_text (text_t *start, text_t value, int len) 39inline void fill_text (text_t *start, text_t value, int len)
38{ 40{
39 while (len--) 41 while (len--)
40 *start++ = value; 42 *start++ = value;
485 prev_nrow = prev_ncol = 0; 487 prev_nrow = prev_ncol = 0;
486 scr_reset (); 488 scr_reset ();
487 489
488 scr_clear (); 490 scr_clear ();
489 scr_refresh (SLOW_REFRESH); 491 scr_refresh (SLOW_REFRESH);
490#ifdef RXVT_GRAPHICS
491 Gr_reset ();
492#endif
493} 492}
494 493
495/* ------------------------------------------------------------------------- * 494/* ------------------------------------------------------------------------- *
496 * PROCESS SCREEN COMMANDS * 495 * PROCESS SCREEN COMMANDS *
497 * ------------------------------------------------------------------------- */ 496 * ------------------------------------------------------------------------- */
593# endif 592# endif
594 SWAP_IT (screen.charset, swap.charset, int16_t); 593 SWAP_IT (screen.charset, swap.charset, int16_t);
595 SWAP_IT (screen.flags, swap.flags, int); 594 SWAP_IT (screen.flags, swap.flags, int);
596 screen.flags |= Screen_VisibleCursor; 595 screen.flags |= Screen_VisibleCursor;
597 swap.flags |= Screen_VisibleCursor; 596 swap.flags |= Screen_VisibleCursor;
598
599# ifdef RXVT_GRAPHICS
600
601 if (Gr_Displayed ())
602 {
603 Gr_scroll (0);
604 Gr_ChangeScreen ();
605 }
606# endif
607#else 597#else
608# ifdef SCROLL_ON_NO_SECONDARY 598# ifdef SCROLL_ON_NO_SECONDARY
609# ifdef RXVT_GRAPHICS
610 if (Gr_Displayed ())
611 Gr_ClearScreen ();
612# endif
613 if (current_screen == PRIMARY 599 if (current_screen == PRIMARY)
614# ifdef RXVT_GRAPHICS
615 && !Gr_Displayed ()
616# endif
617 )
618 scr_scroll_text (0, (prev_nrow - 1), prev_nrow, 0); 600 scr_scroll_text (0, (prev_nrow - 1), prev_nrow, 0);
619# endif 601# endif
620#endif 602#endif
621 return scrn; 603 return scrn;
622} 604}
771 753
772 if (!spec) /* line length may not equal TermWin.ncol */ 754 if (!spec) /* line length may not equal TermWin.ncol */
773 scr_blank_screen_mem (screen.text, screen.rend, 755 scr_blank_screen_mem (screen.text, screen.rend,
774 (unsigned int)j, rstyle); 756 (unsigned int)j, rstyle);
775 } 757 }
776
777#ifdef RXVT_GRAPHICS
778 if (Gr_Displayed ())
779 Gr_scroll (count);
780#endif
781 758
782 return count; 759 return count;
783} 760}
784 761
785/* ------------------------------------------------------------------------- */ 762/* ------------------------------------------------------------------------- */
887 scr_insdel_chars (1, INSERT); 864 scr_insdel_chars (1, INSERT);
888 865
889 if (charsets[screen.charset] == '0') // DEC SPECIAL 866 if (charsets[screen.charset] == '0') // DEC SPECIAL
890 switch (c) 867 switch (c)
891 { 868 {
869 // dunno where these come from
870#if 0
892 case '+': c = 0x2192; break; case ',': c = 0x2190; break; case '-': c = 0x2191; break; 871 case '+': c = 0x2192; break; case ',': c = 0x2190; break; case '-': c = 0x2191; break;
893 case '.': c = 0x2193; break; case '0': c = 0x25ae; break; case '`': c = 0x25c6; break; 872 case '.': c = 0x2193; break; case '0': c = 0x25ae; break;
873#endif
874 // vt100 special graphics and line drawing
875 case '`': c = 0x25c6; break; case '_': c = 0x0020; break;
894 case 'a': c = 0x2592; break; case 'f': c = 0x00b0; break; case 'g': c = 0x00b1; break; 876 case 'a': c = 0x2592; break; case 'b': c = 0x2409; break; case 'c': c = 0x240c; break;
895 case 'h': c = 0x2592; break; case 'i': c = 0x2603; break; case 'j': c = 0x2518; break;
896 case 'k': c = 0x2510; break; case 'l': c = 0x250c; break; case 'm': c = 0x2514; break; 877 case 'd': c = 0x240d; break; case 'e': c = 0x240a; break; case 'f': c = 0x00b0; break;
878 case 'g': c = 0x00b1; break; case 'h': c = 0x2424; break; case 'i': c = 0x240b; break;
897 case 'n': c = 0x253c; break; case 'o': c = 0x23ba; break; case 'p': c = 0x23bb; break; 879 case 'j': c = 0x2518; break; case 'k': c = 0x2510; break; case 'l': c = 0x250c; break;
898 case 'q': c = 0x2500; break; case 'r': c = 0x23bc; break; case 's': c = 0x23bd; break; 880 case 'm': c = 0x2514; break; case 'n': c = 0x253c; break; case 'o': c = 0x23ba; break;
899 case 't': c = 0x251c; break; case 'u': c = 0x2524; break; case 'v': c = 0x2534; break; 881 case 'p': c = 0x23bb; break; case 'q': c = 0x2500; break; case 'r': c = 0x23bc; break;
900 case 'w': c = 0x252c; break; case 'x': c = 0x2502; break; case 'y': c = 0x2264; break; 882 case 's': c = 0x23bd; break; case 't': c = 0x251c; break; case 'u': c = 0x2524; break;
901 case 'z': c = 0x2265; break; case '{': c = 0x03c0; break; case '|': c = 0x2260; break; 883 case 'v': c = 0x2534; break; case 'w': c = 0x252c; break; case 'x': c = 0x2502; break;
884 case 'y': c = 0x2264; break; case 'z': c = 0x2265; break; case '{': c = 0x03c0; break;
902 case '}': c = 0x00a3; break; case '~': c = 0x00b7; break; 885 case '|': c = 0x2260; break; case '}': c = 0x00a3; break; case '~': c = 0x00b7; break;
903 } 886 }
904 887
905 rend_t rend = SET_FONT (rstyle, TermWin.fontset->find_font (c)); 888 rend_t rend = SET_FONT (rstyle, TermWin.fontset->find_font (c));
906 // rely on wcwidth to tell us the character width, at least for non-ascii 889 // rely on wcwidth to tell us the character width, at least for non-ascii
907 int width = c <= 128 ? 1 : wcwidth (c); 890 int width = c <= 128 ? 1 : wcwidth (c);
1075void 1058void
1076rxvt_term::scr_gotorc (int row, int col, int relative) 1059rxvt_term::scr_gotorc (int row, int col, int relative)
1077{ 1060{
1078 want_refresh = 1; 1061 want_refresh = 1;
1079 ZERO_SCROLLBACK (); 1062 ZERO_SCROLLBACK ();
1080#ifdef RXVT_GRAPHICS
1081 if (Gr_Displayed ())
1082 Gr_scroll (0);
1083#endif
1084 1063
1085 D_SCREEN ((stderr, "rxvt_scr_gotorc (r:%s%d,c:%s%d): from (r:%d,c:%d)", (relative & R_RELATIVE ? "+" : ""), row, (relative & C_RELATIVE ? "+" : ""), col, screen.cur.row, screen.cur.col)); 1064 D_SCREEN ((stderr, "rxvt_scr_gotorc (r:%s%d,c:%s%d): from (r:%d,c:%d)", (relative & R_RELATIVE ? "+" : ""), row, (relative & C_RELATIVE ? "+" : ""), col, screen.cur.row, screen.cur.col));
1086 1065
1087 screen.cur.col = ((relative & C_RELATIVE) ? (screen.cur.col + col) 1066 screen.cur.col = ((relative & C_RELATIVE) ? (screen.cur.col + col)
1088 : col); 1067 : col);
1135 want_refresh = 1; 1114 want_refresh = 1;
1136 dirn = ((direction == UP) ? 1 : -1); 1115 dirn = ((direction == UP) ? 1 : -1);
1137 D_SCREEN ((stderr, "rxvt_scr_index (%d)", dirn)); 1116 D_SCREEN ((stderr, "rxvt_scr_index (%d)", dirn));
1138 1117
1139 ZERO_SCROLLBACK (); 1118 ZERO_SCROLLBACK ();
1140
1141#ifdef RXVT_GRAPHICS
1142 if (Gr_Displayed ())
1143 Gr_scroll (0);
1144#endif
1145 1119
1146 screen.flags &= ~Screen_WrapNext; 1120 screen.flags &= ~Screen_WrapNext;
1147 if ((screen.cur.row == screen.bscroll && direction == UP) 1121 if ((screen.cur.row == screen.bscroll && direction == UP)
1148 || (screen.cur.row == screen.tscroll && direction == DN)) 1122 || (screen.cur.row == screen.tscroll && direction == DN))
1149 scr_scroll_text (screen.tscroll, screen.bscroll, dirn, 0); 1123 scr_scroll_text (screen.tscroll, screen.bscroll, dirn, 0);
1167 unsigned int row, col, num; 1141 unsigned int row, col, num;
1168 1142
1169 want_refresh = 1; 1143 want_refresh = 1;
1170 D_SCREEN ((stderr, "rxvt_scr_erase_line (%d) at screen row: %d", mode, screen.cur.row)); 1144 D_SCREEN ((stderr, "rxvt_scr_erase_line (%d) at screen row: %d", mode, screen.cur.row));
1171 ZERO_SCROLLBACK (); 1145 ZERO_SCROLLBACK ();
1172
1173#ifdef RXVT_GRAPHICS
1174 if (Gr_Displayed ())
1175 Gr_scroll (0);
1176#endif
1177 1146
1178 selection_check (1); 1147 selection_check (1);
1179 1148
1180 screen.flags &= ~Screen_WrapNext; 1149 screen.flags &= ~Screen_WrapNext;
1181 1150
1250 row = 0; 1219 row = 0;
1251 num = screen.cur.row; 1220 num = screen.cur.row;
1252 break; 1221 break;
1253 case 2: /* erase whole screen */ 1222 case 2: /* erase whole screen */
1254 selection_check (3); 1223 selection_check (3);
1255#ifdef RXVT_GRAPHICS
1256 Gr_ClearScreen ();
1257#endif
1258 row = 0; 1224 row = 0;
1259 num = TermWin.nrow; 1225 num = TermWin.nrow;
1260 break; 1226 break;
1261 default: 1227 default:
1262 return; 1228 return;
1331{ 1297{
1332 int end; 1298 int end;
1333 1299
1334 ZERO_SCROLLBACK (); 1300 ZERO_SCROLLBACK ();
1335 1301
1336#ifdef RXVT_GRAPHICS
1337 if (Gr_Displayed ())
1338 Gr_scroll (0);
1339#endif
1340
1341 selection_check (1); 1302 selection_check (1);
1342 1303
1343 if (screen.cur.row > screen.bscroll) 1304 if (screen.cur.row > screen.bscroll)
1344 return; 1305 return;
1345 1306
1369 rend_t *srp; 1330 rend_t *srp;
1370 int16_t *slp; 1331 int16_t *slp;
1371 1332
1372 want_refresh = 1; 1333 want_refresh = 1;
1373 ZERO_SCROLLBACK (); 1334 ZERO_SCROLLBACK ();
1374
1375#ifdef RXVT_GRAPHICS
1376 if (Gr_Displayed ())
1377 Gr_scroll (0);
1378#endif
1379 1335
1380 if (count <= 0) 1336 if (count <= 0)
1381 return; 1337 return;
1382 1338
1383 selection_check (1); 1339 selection_check (1);
1808rxvt_term::scr_changeview (uint16_t oldviewstart) 1764rxvt_term::scr_changeview (uint16_t oldviewstart)
1809{ 1765{
1810 if (TermWin.view_start != oldviewstart) 1766 if (TermWin.view_start != oldviewstart)
1811 { 1767 {
1812 want_refresh = 1; 1768 want_refresh = 1;
1813#ifdef RXVT_GRAPHICS
1814 if (Gr_Displayed ())
1815 Gr_scroll (0);
1816#endif
1817 num_scr -= (TermWin.view_start - oldviewstart); 1769 num_scr -= (TermWin.view_start - oldviewstart);
1818 } 1770 }
1819 return (int) (TermWin.view_start - oldviewstart); 1771 return (int) (TermWin.view_start - oldviewstart);
1820} 1772}
1821 1773
1891 ((Y) >= (X)->min_char_or_byte2 && (Y) <= (X)->max_char_or_byte2) 1843 ((Y) >= (X)->min_char_or_byte2 && (Y) <= (X)->max_char_or_byte2)
1892 1844
1893void 1845void
1894rxvt_term::scr_refresh (unsigned char refresh_type) 1846rxvt_term::scr_refresh (unsigned char refresh_type)
1895{ 1847{
1896 unsigned char clearfirst, /* first character writes before cell */ 1848 unsigned char clearfirst, /* first character writes before cell */
1897 clearlast, /* last character writes beyond cell */ 1849 clearlast, /* last character writes beyond cell */
1898 must_clear, /* use draw_string not draw_image_string */ 1850 must_clear, /* use draw_string not draw_image_string */
1899 rvid, /* reverse video this position */ 1851 rvid, /* reverse video this position */
1900 showcursor; /* show the cursor */ 1852 showcursor; /* show the cursor */
1901 int16_t col, row, /* column/row we're processing */ 1853 int16_t col, row, /* column/row we're processing */
1902 ocrow; /* old cursor row */ 1854 ocrow; /* old cursor row */
1903 int cursorwidth;
1904 int i, /* tmp */ 1855 int i, /* tmp */
1905 row_offset; /* basic offset in screen structure */ 1856 row_offset; /* basic offset in screen structure */
1906#ifndef NO_CURSORCOLOR 1857#ifndef NO_CURSORCOLOR
1907 rend_t cc1; /* store colours at cursor position (s) */ 1858 rend_t cc1; /* store colours at cursor position (s) */
1908#endif 1859#endif
1909 rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */ 1860 rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */
1910 text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */ 1861 text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */
1911 1862
1912 if (refresh_type == NO_REFRESH || !TermWin.mapped) 1863 if (refresh_type == NO_REFRESH || !TermWin.mapped)
1913 return; 1864 return;
1914 1865
1915 /* 1866 /*
1947 unsigned char setoldcursor; 1898 unsigned char setoldcursor;
1948 rend_t ccol1, /* Cursor colour */ 1899 rend_t ccol1, /* Cursor colour */
1949 ccol2; /* Cursor colour2 */ 1900 ccol2; /* Cursor colour2 */
1950 1901
1951 showcursor = (screen.flags & Screen_VisibleCursor); 1902 showcursor = (screen.flags & Screen_VisibleCursor);
1952 cursorwidth = 0;
1953#ifdef CURSOR_BLINK 1903#ifdef CURSOR_BLINK
1954 if (hidden_cursor) 1904 if (hidden_cursor)
1955 showcursor = 0; 1905 showcursor = 0;
1956#endif 1906#endif
1957 1907
1958 cursorwidth = 0;
1959
1960 if (showcursor) 1908 if (showcursor)
1961 { 1909 {
1962 cursorwidth++;
1963
1964 srp = & (screen.rend[screen.cur.row + TermWin.saveLines] 1910 srp = & (screen.rend[screen.cur.row + TermWin.saveLines]
1965 [screen.cur.col]); 1911 [screen.cur.col]);
1966 1912
1967 if (showcursor && TermWin.focus) 1913 if (showcursor && TermWin.focus)
1968 { 1914 {
1986 ccol2 = Color_bg; 1932 ccol2 = Color_bg;
1987#endif 1933#endif
1988 *srp = SET_FGCOLOR (*srp, ccol1); 1934 *srp = SET_FGCOLOR (*srp, ccol1);
1989 *srp = SET_BGCOLOR (*srp, ccol2); 1935 *srp = SET_BGCOLOR (*srp, ccol2);
1990#endif 1936#endif
1991
1992 } 1937 }
1993 } 1938 }
1994 1939
1995 /* make sure no outline cursor is left around */ 1940 /* make sure no outline cursor is left around */
1996 setoldcursor = 0; 1941 setoldcursor = 0;
2177 int fore = GET_FGCOLOR (rend); // desired foreground 2122 int fore = GET_FGCOLOR (rend); // desired foreground
2178 int back = GET_BGCOLOR (rend); // desired background 2123 int back = GET_BGCOLOR (rend); // desired background
2179 2124
2180 rend = GET_ATTR (rend); 2125 rend = GET_ATTR (rend);
2181 2126
2182 rvid = !! (rend & RS_RVid); 2127 rvid = !!(rend & RS_RVid);
2128
2129#ifndef NO_BOLD_UNDERLINE_REVERSE
2130 if (rend & RS_Bold && fore == Color_fg)
2131 {
2132 if (ISSET_PIXCOLOR (Color_BD))
2133 fore = Color_BD;
2134 else
2135 rvid = !rvid;
2136 }
2137
2138 if (rend & RS_Uline)
2139 {
2140 if (ISSET_PIXCOLOR (Color_UL))
2141 fore = Color_UL;
2142 }
2143#endif
2144
2183 if (rvid) 2145 if (rvid)
2184 { 2146 {
2185 SWAP_IT (fore, back, int); 2147 SWAP_IT (fore, back, int);
2186 2148
2187#ifndef NO_BOLD_UNDERLINE_REVERSE 2149#ifndef NO_BOLD_UNDERLINE_REVERSE
2190 && !ISSET_PIXCOLOR (Color_cursor) 2152 && !ISSET_PIXCOLOR (Color_cursor)
2191# endif 2153# endif
2192 ) 2154 )
2193 back = Color_RV; 2155 back = Color_RV;
2194#endif 2156#endif
2195
2196 } 2157 }
2158
2197#ifdef TEXT_BLINK 2159#ifdef TEXT_BLINK
2198 if (rend & RS_Blink) 2160 if (rend & RS_Blink && back == Color_bg)
2199 { 2161 {
2200 if (!text_blink_ev.active) 2162 if (!text_blink_ev.active)
2201 { 2163 {
2202 text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); 2164 text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL);
2203 hidden_text = 0; 2165 hidden_text = 0;
2204 } 2166 }
2205 else if (hidden_text) 2167 else if (hidden_text)
2206 fore = back; 2168 fore = back;
2207 } 2169 }
2208#endif 2170#endif
2209#ifndef NO_BOLD_UNDERLINE_REVERSE
2210 else if (rend & RS_Bold)
2211 {
2212 if (ISSET_PIXCOLOR (Color_BD))
2213 fore = Color_BD;
2214 else if (fore == Color_fg)
2215 fore = Color_White;
2216 }
2217 else if (rend & RS_Uline)
2218 {
2219 if (ISSET_PIXCOLOR (Color_UL))
2220 fore = Color_UL;
2221 }
2222#endif
2223 2171
2224 /* 2172 /*
2225 * Actually do the drawing of the string here 2173 * Actually do the drawing of the string here
2226 */ 2174 */
2227 rxvt_font *font = (*TermWin.fontset)[fid]; 2175 rxvt_font *font = (*TermWin.fontset)[fid];
2228 2176
2229 if (back == fore) 2177 if (back == fore)
2230 font->clear_rect (xpixel, ypixel, 2178 font->clear_rect (*TermWin.drawable, xpixel, ypixel,
2231 TermWin.fwidth * count, TermWin.fheight, 2179 TermWin.fwidth * count, TermWin.fheight,
2232 back); 2180 back);
2233 else if (back == Color_bg) 2181 else if (back == Color_bg)
2234 { 2182 {
2235 if (must_clear) 2183 if (must_clear)
2237 CLEAR_CHARS (xpixel, ypixel, count); 2185 CLEAR_CHARS (xpixel, ypixel, count);
2238 2186
2239 for (i = 0; i < count; i++) /* don't draw empty strings */ 2187 for (i = 0; i < count; i++) /* don't draw empty strings */
2240 if (text[i] != ' ') 2188 if (text[i] != ' ')
2241 { 2189 {
2242 font->draw (xpixel, ypixel, text, count, fore, -1); 2190 font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, -1);
2243 break; 2191 break;
2244 } 2192 }
2245 } 2193 }
2246 else 2194 else
2247 font->draw (xpixel, ypixel, text, count, fore, Color_bg); 2195 font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, Color_bg);
2248 } 2196 }
2249 else 2197 else
2250 font->draw (xpixel, ypixel, text, count, fore, back); 2198 font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, back);
2251 2199
2252 if ((rend & RS_Uline) && (font->descent > 1)) 2200 if ((rend & RS_Uline) && (font->descent > 1))
2253 XDrawLine (display->display, drawBuffer, TermWin.gc, 2201 XDrawLine (display->display, drawBuffer, TermWin.gc,
2254 xpixel, ypixel + font->ascent + 1, 2202 xpixel, ypixel + font->ascent + 1,
2255 xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); 2203 xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1);
2267 [screen.cur.col]); 2215 [screen.cur.col]);
2268 *srp ^= RS_RVid; 2216 *srp ^= RS_RVid;
2269#ifndef NO_CURSORCOLOR 2217#ifndef NO_CURSORCOLOR
2270 *srp = (*srp & ~ (RS_fgMask | RS_bgMask)) | cc1; 2218 *srp = (*srp & ~ (RS_fgMask | RS_bgMask)) | cc1;
2271#endif 2219#endif
2272
2273 } 2220 }
2274 else if (oldcursor.row >= 0) 2221 else if (oldcursor.row >= 0)
2275 { 2222 {
2276#ifndef NO_CURSORCOLOR 2223#ifndef NO_CURSORCOLOR
2277 if (ISSET_PIXCOLOR (Color_cursor)) 2224 if (ISSET_PIXCOLOR (Color_cursor))
2278 XSetForeground (display->display, TermWin.gc, PixColors[Color_cursor]); 2225 XSetForeground (display->display, TermWin.gc, PixColors[Color_cursor]);
2279#endif 2226#endif
2227 int cursorwidth = 1;
2228 while (oldcursor.col + cursorwidth < TermWin.ncol
2229 && drawn_text[oldcursor.row][oldcursor.col + cursorwidth] == NOCHAR)
2230 cursorwidth++;
2231
2280 XDrawRectangle (display->display, drawBuffer, TermWin.gc, 2232 XDrawRectangle (display->display, drawBuffer, TermWin.gc,
2281 Col2Pixel (oldcursor.col), 2233 Col2Pixel (oldcursor.col),
2282 Row2Pixel (oldcursor.row), 2234 Row2Pixel (oldcursor.row),
2283 (unsigned int) (Width2Pixel (cursorwidth) - 1), 2235 (unsigned int) (Width2Pixel (cursorwidth) - 1),
2284 (unsigned int) (Height2Pixel (1) - TermWin.lineSpace - 1)); 2236 (unsigned int) (Height2Pixel (1) - TermWin.lineSpace - 1));
2316 num_scr = 0; 2268 num_scr = 0;
2317 num_scr_allow = 1; 2269 num_scr_allow = 1;
2318 want_refresh = 0; /* screen is current */ 2270 want_refresh = 0; /* screen is current */
2319} 2271}
2320 2272
2273void
2274rxvt_term::scr_remap_chars (text_t *tp, rend_t *rp)
2275{
2276 if (!rp || !tp)
2277 return;
2278
2279 for (int i = TermWin.ncol; i; i--, rp++, tp++)
2280 *rp = SET_FONT (*rp, TermWin.fontset->find_font (*tp));
2281}
2282
2283void
2284rxvt_term::scr_remap_chars ()
2285{
2286 for (int i = TermWin.nrow + TermWin.saveLines; i--; )
2287 scr_remap_chars (screen.text[i], screen.rend[i]);
2288
2289 for (int i = TermWin.nrow; i--; )
2290 {
2291 scr_remap_chars (drawn_text[i], drawn_rend[i]);
2292 scr_remap_chars (swap.text[i], swap.rend[i]);
2293 }
2294}
2295
2321/* ------------------------------------------------------------------------- */ 2296/* ------------------------------------------------------------------------- */
2322void 2297void
2323rxvt_term::scr_clear () 2298rxvt_term::scr_clear ()
2324{ 2299{
2325 if (!TermWin.mapped) 2300 if (!TermWin.mapped)
2515 } 2490 }
2516 2491
2517 for (;;) 2492 for (;;)
2518 { 2493 {
2519 if (XGetWindowProperty (display->display, win, prop, (long) (nread / 4), 2494 if (XGetWindowProperty (display->display, win, prop, (long) (nread / 4),
2520 (long) (PROP_SIZE / 4), delete_prop, 2495 (long) (PROP_SIZE / 4), delete_prop,
2521 AnyPropertyType, &ct.encoding, &ct.format, 2496 AnyPropertyType, &ct.encoding, &ct.format,
2522 &ct.nitems, &bytes_after, 2497 &ct.nitems, &bytes_after,
2523 &ct.value) != Success) 2498 &ct.value) != Success)
2524 break; 2499 break;
2525 2500
2526 if (ct.encoding == 0) 2501 if (ct.encoding == 0)
2527 { 2502 {
2528 D_SELECT ((stderr, "rxvt_selection_paste: property didn't exist!")); 2503 D_SELECT ((stderr, "rxvt_selection_paste: property didn't exist!"));
2536 } 2511 }
2537 2512
2538 if (ct.nitems == 0) 2513 if (ct.nitems == 0)
2539 { 2514 {
2540 D_SELECT ((stderr, "rxvt_selection_paste: property empty - also INCR end")); 2515 D_SELECT ((stderr, "rxvt_selection_paste: property empty - also INCR end"));
2541 if (selection_wait == Sel_normal && nread == 0) 2516 if (selection_wait == Sel_normal && nread == 0
2517 && (win != display->root || prop != XA_CUT_BUFFER0)) // avoid recursion
2542 { 2518 {
2543 /* 2519 /*
2544 * pass through again trying CUT_BUFFER0 if we've come from 2520 * pass through again trying CUT_BUFFER0 if we've come from
2545 * XConvertSelection () but nothing was presented 2521 * XConvertSelection () but nothing was presented
2546 */ 2522 */
2723rxvt_term::selection_clear () 2699rxvt_term::selection_clear ()
2724{ 2700{
2725 D_SELECT ((stderr, "rxvt_selection_clear ()")); 2701 D_SELECT ((stderr, "rxvt_selection_clear ()"));
2726 2702
2727 want_refresh = 1; 2703 want_refresh = 1;
2728 if (selection.text)
2729 free (selection.text); 2704 free (selection.text);
2730 selection.text = NULL; 2705 selection.text = NULL;
2731 selection.len = 0; 2706 selection.len = 0;
2732 CLEAR_SELECTION (); 2707 CLEAR_SELECTION ();
2733} 2708}
2734 2709
2760 selection.op = SELECTION_DONE; 2735 selection.op = SELECTION_DONE;
2761 /* FALLTHROUGH */ 2736 /* FALLTHROUGH */
2762 default: 2737 default:
2763 return; 2738 return;
2764 } 2739 }
2740
2765 selection.op = SELECTION_DONE; 2741 selection.op = SELECTION_DONE;
2766 2742
2767 if (selection.clicks == 4) 2743 if (selection.clicks == 4)
2768 return; /* nothing selected, go away */ 2744 return; /* nothing selected, go away */
2769 2745
2820 { 2796 {
2821 free (new_selection_text); 2797 free (new_selection_text);
2822 return; 2798 return;
2823 } 2799 }
2824 2800
2825 // due to MB_MAX_CUR, selection wastage is usually high, so realloc 2801 // due to MB_CUR_MAX, selection wastage is usually high, so realloc
2826 if (str - (char *)new_selection_text > 1024) 2802 if (str - (char *)new_selection_text > 1024)
2827 new_selection_text = (unsigned char *)rxvt_realloc (new_selection_text, i + 1); 2803 new_selection_text = (unsigned char *)rxvt_realloc (new_selection_text, i + 1);
2828 2804
2829 selection.len = i; 2805 selection.len = i;
2830 2806
2844 char *cl = (char *)selection.text; 2820 char *cl = (char *)selection.text;
2845 2821
2846 if (XmbTextListToTextProperty (display->display, &cl, 1, XStringStyle, &ct) >= 0) 2822 if (XmbTextListToTextProperty (display->display, &cl, 1, XStringStyle, &ct) >= 0)
2847 { 2823 {
2848 XChangeProperty (display->display, display->root, XA_CUT_BUFFER0, XA_STRING, 8, 2824 XChangeProperty (display->display, display->root, XA_CUT_BUFFER0, XA_STRING, 8,
2849 PropModeReplace, ct.value, ct.nitems); 2825 PropModeReplace, ct.value, ct.nitems);
2850 XFree (ct.value); 2826 XFree (ct.value);
2851 } 2827 }
2852 else 2828 else
2853 XChangeProperty (display->display, display->root, XA_CUT_BUFFER0, XA_STRING, 8, 2829 XChangeProperty (display->display, display->root, XA_CUT_BUFFER0, XA_STRING, 8,
2854 PropModeReplace, selection.text, (int)selection.len); 2830 PropModeReplace, selection.text, (int)selection.len);
2855 } 2831 }
2856 2832
2857 selection_time = tm; 2833 selection_time = tm;
2858 D_SELECT ((stderr, "rxvt_selection_make (): selection.len=%d", selection.len)); 2834 D_SELECT ((stderr, "rxvt_selection_make (): selection.len=%d", selection.len));
2859} 2835}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines