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.177 by root, Tue Dec 20 21:49:55 2005 UTC vs.
Revision 1.183 by root, Wed Dec 21 14:19:19 2005 UTC

83#define ROWCOL_IN_ROW_AT_OR_AFTER(X, Y) \ 83#define ROWCOL_IN_ROW_AT_OR_AFTER(X, Y) \
84 ROW_AND_COL_IN_ROW_AT_OR_AFTER ((X).row, (X).col, (Y).row, (Y).col) 84 ROW_AND_COL_IN_ROW_AT_OR_AFTER ((X).row, (X).col, (Y).row, (Y).col)
85#define ROWCOL_IN_ROW_AT_OR_BEFORE(X, Y) \ 85#define ROWCOL_IN_ROW_AT_OR_BEFORE(X, Y) \
86 ROW_AND_COL_IN_ROW_AT_OR_BEFORE ((X).row, (X).col, (Y).row, (Y).col) 86 ROW_AND_COL_IN_ROW_AT_OR_BEFORE ((X).row, (X).col, (Y).row, (Y).col)
87 87
88#define LINENO(n) (((n) + term_start + total_rows) % total_rows)
89#define ROW(n) (save [LINENO (n)])
90
91/* 88/*
92 * CLEAR_ROWS : clear <num> rows starting from row <row> 89 * CLEAR_ROWS : clear <num> rows starting from row <row>
93 * CLEAR_CHARS: clear <num> chars starting from pixel position <x,y> 90 * CLEAR_CHARS: clear <num> chars starting from pixel position <x,y>
94 * ERASE_ROWS : set <num> rows starting from row <row> to the foreground colour 91 * ERASE_ROWS : set <num> rows starting from row <row> to the foreground colour
95 */ 92 */
261 lfree (swap_save[p]); 258 lfree (swap_save[p]);
262 lfree (drawn[p]); 259 lfree (drawn[p]);
263 } 260 }
264 261
265 /* we have fewer rows so fix up cursor position */ 262 /* we have fewer rows so fix up cursor position */
266 MIN_IT (screen.cur.row, (int32_t)nrow - 1); 263 min_it (screen.cur.row, (int32_t)nrow - 1);
267 264
268 scr_reset_realloc (); /* realloc _last_ */ 265 scr_reset_realloc (); /* realloc _last_ */
269 } 266 }
270 else if (nrow > prev_nrow) 267 else if (nrow > prev_nrow)
271 { 268 {
298 } 295 }
299 296
300#ifdef DEBUG_STRICT 297#ifdef DEBUG_STRICT
301 assert (screen.cur.row < nrow); 298 assert (screen.cur.row < nrow);
302#else /* drive with your eyes closed */ 299#else /* drive with your eyes closed */
303 MIN_IT (screen.cur.row, nrow - 1); 300 min_it (screen.cur.row, nrow - 1);
304#endif 301#endif
305 ncol = ocol; // save b/c scr_blank_screen_mem uses this 302 ncol = ocol; // save b/c scr_blank_screen_mem uses this
306 } 303 }
307 304
308 /* resize columns */ 305 /* resize columns */
318 { 315 {
319 lresize (drawn[p]); 316 lresize (drawn[p]);
320 lresize (swap_save[p]); 317 lresize (swap_save[p]);
321 } 318 }
322 319
323 MIN_IT (screen.cur.col, (int16_t)ncol - 1); 320 min_it (screen.cur.col, (int16_t)ncol - 1);
324 321
325 delete old_ta; 322 delete old_ta;
326 delete old_ra; 323 delete old_ra;
327 } 324 }
328 325
518 set_font_style (); 515 set_font_style ();
519 break; 516 break;
520 } 517 }
521 518
522 /* boundary check in case screen size changed between SAVE and RESTORE */ 519 /* boundary check in case screen size changed between SAVE and RESTORE */
523 MIN_IT (s->cur.row, nrow - 1); 520 min_it (s->cur.row, nrow - 1);
524 MIN_IT (s->cur.col, ncol - 1); 521 min_it (s->cur.col, ncol - 1);
525#ifdef DEBUG_STRICT 522#ifdef DEBUG_STRICT
526 assert (s->cur.row >= 0); 523 assert (s->cur.row >= 0);
527 assert (s->cur.col >= 0); 524 assert (s->cur.col >= 0);
528#else /* drive with your eyes closed */ 525#else /* drive with your eyes closed */
529 MAX_IT (s->cur.row, 0); 526 max_it (s->cur.row, 0);
530 MAX_IT (s->cur.col, 0); 527 max_it (s->cur.col, 0);
531#endif 528#endif
532} 529}
533 530
534/* ------------------------------------------------------------------------- */ 531/* ------------------------------------------------------------------------- */
535/* 532/*
546 if (current_screen == scrn) 543 if (current_screen == scrn)
547 return scrn; 544 return scrn;
548 545
549 selection_check (2); /* check for boundary cross */ 546 selection_check (2); /* check for boundary cross */
550 547
551 SWAP_IT (scrn, current_screen, int); 548 int i = current_screen; current_screen = scrn; scrn = i;
552 549
553 SWAP_IT (screen.cur.row, swap.cur.row, int16_t); 550 ::swap (screen.cur.row, swap.cur.row);
554 SWAP_IT (screen.cur.col, swap.cur.col, int16_t); 551 ::swap (screen.cur.col, swap.cur.col);
555 MAX_IT (screen.cur.row, 0); 552
556 MIN_IT (screen.cur.row, (int32_t)prev_nrow - 1); 553 screen.cur.row = clamp (screen.cur.row, 0, prev_nrow - 1);
557 MAX_IT (screen.cur.col, 0); 554 screen.cur.col = clamp (screen.cur.col, 0, prev_ncol - 1);
558 MIN_IT (screen.cur.col, (int32_t)prev_ncol - 1);
559 555
560#if NSCREENS 556#if NSCREENS
561 if (options & Opt_secondaryScreen) 557 if (options & Opt_secondaryScreen)
562 { 558 {
563 num_scr = 0; 559 num_scr = 0;
564 560
565 for (int i = nrow; i--; ) 561 for (int i = nrow; i--; )
566 SWAP_IT (ROW(i), swap_save[i], line_t); 562 ::swap (ROW(i), swap_save[i]);
567 563
568 SWAP_IT (screen.charset, swap.charset, int16_t); 564 ::swap (screen.charset, swap.charset);
569 SWAP_IT (screen.flags, swap.flags, int); 565 ::swap (screen.flags, swap.flags);
570 screen.flags |= Screen_VisibleCursor; 566 screen.flags |= Screen_VisibleCursor;
571 swap.flags |= Screen_VisibleCursor; 567 swap.flags |= Screen_VisibleCursor;
572 } 568 }
573 else 569 else
574#endif 570#endif
749#ifdef DEBUG_STRICT 745#ifdef DEBUG_STRICT
750 assert (screen.cur.col < last_col); 746 assert (screen.cur.col < last_col);
751 assert ((screen.cur.row < nrow) 747 assert ((screen.cur.row < nrow)
752 && (screen.cur.row >= - (int32_t)nsaved)); 748 && (screen.cur.row >= - (int32_t)nsaved));
753#else /* drive with your eyes closed */ 749#else /* drive with your eyes closed */
754 MIN_IT (screen.cur.col, last_col - 1); 750 min_it (screen.cur.col, last_col - 1);
755 MIN_IT (screen.cur.row, (int32_t)nrow - 1); 751 min_it (screen.cur.row, (int32_t)nrow - 1);
756 MAX_IT (screen.cur.row, - (int32_t)nsaved); 752 max_it (screen.cur.row, - (int32_t)nsaved);
757#endif 753#endif
758 row = screen.cur.row; 754 row = screen.cur.row;
759 755
760 checksel = selection.op && current_screen == selection.screen ? 1 : 0; 756 checksel = selection.op && current_screen == selection.screen ? 1 : 0;
761 757
767 763
768 if (c < 0x20) 764 if (c < 0x20)
769 if (c == C0_LF) 765 if (c == C0_LF)
770 { 766 {
771 if (!line->is_longer ()) /* XXX: think about this */ 767 if (!line->is_longer ()) /* XXX: think about this */
772 MAX_IT (line->l, screen.cur.col); 768 max_it (line->l, screen.cur.col);
773 769
774 screen.flags &= ~Screen_WrapNext; 770 screen.flags &= ~Screen_WrapNext;
775 771
776 if (screen.cur.row == screen.bscroll) 772 if (screen.cur.row == screen.bscroll)
777 scr_scroll_text (screen.tscroll, screen.bscroll, 1); 773 scr_scroll_text (screen.tscroll, screen.bscroll, 1);
782 continue; 778 continue;
783 } 779 }
784 else if (c == C0_CR) 780 else if (c == C0_CR)
785 { 781 {
786 if (!line->is_longer ()) /* XXX: think about this */ 782 if (!line->is_longer ()) /* XXX: think about this */
787 MAX_IT (line->l, screen.cur.col); 783 max_it (line->l, screen.cur.col);
788 784
789 screen.flags &= ~Screen_WrapNext; 785 screen.flags &= ~Screen_WrapNext;
790 screen.cur.col = 0; 786 screen.cur.col = 0;
791 continue; 787 continue;
792 } 788 }
968#endif 964#endif
969 } 965 }
970 } 966 }
971 967
972 if (!line->is_longer ()) /* XXX: think about this */ 968 if (!line->is_longer ()) /* XXX: think about this */
973 MAX_IT (line->l, screen.cur.col); 969 max_it (line->l, screen.cur.col);
974 970
975#ifdef DEBUG_STRICT 971#ifdef DEBUG_STRICT
976 assert (screen.cur.row >= 0); 972 assert (screen.cur.row >= 0);
977#else /* drive with your eyes closed */ 973#else /* drive with your eyes closed */
978 MAX_IT (screen.cur.row, 0); 974 max_it (screen.cur.row, 0);
979#endif 975#endif
980} 976}
981 977
982/* ------------------------------------------------------------------------- */ 978/* ------------------------------------------------------------------------- */
983/* 979/*
1049 if (ht && options & Opt_pastableTabs) 1045 if (ht && options & Opt_pastableTabs)
1050 { 1046 {
1051 base_rend = SET_FONT (base_rend, 0); 1047 base_rend = SET_FONT (base_rend, 0);
1052 1048
1053 if (!l.is_longer ()) /* XXX: think about this */ 1049 if (!l.is_longer ()) /* XXX: think about this */
1054 MAX_IT (l.l, x); 1050 max_it (l.l, x);
1055 1051
1056 i = screen.cur.col; 1052 i = screen.cur.col;
1057 1053
1058 l.t[i] = '\t'; 1054 l.t[i] = '\t';
1059 l.r[i] = base_rend; 1055 l.r[i] = base_rend;
1138{ 1134{
1139 want_refresh = 1; 1135 want_refresh = 1;
1140 ZERO_SCROLLBACK (); 1136 ZERO_SCROLLBACK ();
1141 1137
1142 screen.cur.col = relative & C_RELATIVE ? screen.cur.col + col : col; 1138 screen.cur.col = relative & C_RELATIVE ? screen.cur.col + col : col;
1143 MAX_IT (screen.cur.col, 0); 1139 max_it (screen.cur.col, 0);
1144 MIN_IT (screen.cur.col, (int32_t)ncol - 1); 1140 min_it (screen.cur.col, (int32_t)ncol - 1);
1145 1141
1146 screen.flags &= ~Screen_WrapNext; 1142 screen.flags &= ~Screen_WrapNext;
1147 1143
1148 if (relative & R_RELATIVE) 1144 if (relative & R_RELATIVE)
1149 { 1145 {
1167 else 1163 else
1168 { 1164 {
1169 if (screen.flags & Screen_Relative) 1165 if (screen.flags & Screen_Relative)
1170 { /* relative origin mode */ 1166 { /* relative origin mode */
1171 screen.cur.row = row + screen.tscroll; 1167 screen.cur.row = row + screen.tscroll;
1172 MIN_IT (screen.cur.row, screen.bscroll); 1168 min_it (screen.cur.row, screen.bscroll);
1173 } 1169 }
1174 else 1170 else
1175 screen.cur.row = row; 1171 screen.cur.row = row;
1176 } 1172 }
1177 1173
1178 MAX_IT (screen.cur.row, 0); 1174 max_it (screen.cur.row, 0);
1179 MIN_IT (screen.cur.row, (int32_t)nrow - 1); 1175 min_it (screen.cur.row, (int32_t)nrow - 1);
1180} 1176}
1181 1177
1182/* ------------------------------------------------------------------------- */ 1178/* ------------------------------------------------------------------------- */
1183/* 1179/*
1184 * direction should be UP or DN 1180 * direction should be UP or DN
1199 || (screen.cur.row == screen.tscroll && direction == DN)) 1195 || (screen.cur.row == screen.tscroll && direction == DN))
1200 scr_scroll_text (screen.tscroll, screen.bscroll, dirn); 1196 scr_scroll_text (screen.tscroll, screen.bscroll, dirn);
1201 else 1197 else
1202 screen.cur.row += dirn; 1198 screen.cur.row += dirn;
1203 1199
1204 MAX_IT (screen.cur.row, 0); 1200 max_it (screen.cur.row, 0);
1205 MIN_IT (screen.cur.row, (int32_t)nrow - 1); 1201 min_it (screen.cur.row, (int32_t)nrow - 1);
1206 selection_check (0); 1202 selection_check (0);
1207} 1203}
1208 1204
1209/* ------------------------------------------------------------------------- */ 1205/* ------------------------------------------------------------------------- */
1210/* 1206/*
1228 switch (mode) 1224 switch (mode)
1229 { 1225 {
1230 case 0: /* erase to end of line */ 1226 case 0: /* erase to end of line */
1231 col = screen.cur.col; 1227 col = screen.cur.col;
1232 num = ncol - col; 1228 num = ncol - col;
1233 MIN_IT (ROW(row).l, (int16_t)col); 1229 min_it (ROW(row).l, (int16_t)col);
1234 if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) 1230 if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)
1235 || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) 1231 || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur))
1236 CLEAR_SELECTION (); 1232 CLEAR_SELECTION ();
1237 break; 1233 break;
1238 case 1: /* erase to beginning of line */ 1234 case 1: /* erase to beginning of line */
1305 CLEAR_SELECTION (); 1301 CLEAR_SELECTION ();
1306 1302
1307 if (row >= nrow) /* Out Of Bounds */ 1303 if (row >= nrow) /* Out Of Bounds */
1308 return; 1304 return;
1309 1305
1310 MIN_IT (num, (nrow - row)); 1306 min_it (num, (nrow - row));
1311 1307
1312 if (rstyle & (RS_RVid | RS_Uline)) 1308 if (rstyle & (RS_RVid | RS_Uline))
1313 ren = (rend_t) ~RS_None; 1309 ren = (rend_t) ~RS_None;
1314 else if (GET_BASEBG (rstyle) == Color_bg) 1310 else if (GET_BASEBG (rstyle) == Color_bg)
1315 { 1311 {
1423 return; 1419 return;
1424 1420
1425 scr_do_wrap (); 1421 scr_do_wrap ();
1426 1422
1427 selection_check (1); 1423 selection_check (1);
1428 MIN_IT (count, (ncol - screen.cur.col)); 1424 min_it (count, (ncol - screen.cur.col));
1429 1425
1430 row = screen.cur.row; 1426 row = screen.cur.row;
1431 1427
1432 line_t *line = &ROW(row); 1428 line_t *line = &ROW(row);
1433 1429
1441 } 1437 }
1442 1438
1443 if (!line->is_longer ()) 1439 if (!line->is_longer ())
1444 { 1440 {
1445 line->l += count; 1441 line->l += count;
1446 MIN_IT (line->l, ncol); 1442 min_it (line->l, ncol);
1447 } 1443 }
1448 1444
1449 if (selection.op && current_screen == selection.screen 1445 if (selection.op && current_screen == selection.screen
1450 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) 1446 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur))
1451 { 1447 {
1512 * XTERM_SEQ: Set region <top> - <bot> inclusive: ESC [ <top> ; <bot> r 1508 * XTERM_SEQ: Set region <top> - <bot> inclusive: ESC [ <top> ; <bot> r
1513 */ 1509 */
1514void 1510void
1515rxvt_term::scr_scroll_region (int top, int bot) 1511rxvt_term::scr_scroll_region (int top, int bot)
1516{ 1512{
1517 MAX_IT (top, 0); 1513 max_it (top, 0);
1518 MIN_IT (bot, (int)nrow - 1); 1514 min_it (bot, (int)nrow - 1);
1519 1515
1520 if (top > bot) 1516 if (top > bot)
1521 return; 1517 return;
1522 1518
1523 screen.tscroll = top; 1519 screen.tscroll = top;
1621 XGCValues gcvalue; 1617 XGCValues gcvalue;
1622 1618
1623 if (rvideo != mode) 1619 if (rvideo != mode)
1624 { 1620 {
1625 rvideo = mode; 1621 rvideo = mode;
1626 SWAP_IT (pix_colors[Color_fg], pix_colors[Color_bg], rxvt_color); 1622 ::swap (pix_colors[Color_fg], pix_colors[Color_bg]);
1627#if XPM_BACKGROUND 1623#if XPM_BACKGROUND
1628 if (bgPixmap.pixmap == None) 1624 if (bgPixmap.pixmap == None)
1629#endif 1625#endif
1630#if TRANSPARENT 1626#if TRANSPARENT
1631 if (! (options & Opt_transparent) || am_transparent == 0) 1627 if (! (options & Opt_transparent) || am_transparent == 0)
1783 rc[PART_END].row = Pixel2Row (y + eheight + fheight - 1); 1779 rc[PART_END].row = Pixel2Row (y + eheight + fheight - 1);
1784 1780
1785 /* sanity checks */ 1781 /* sanity checks */
1786 for (i = PART_BEG; i < RC_COUNT; i++) 1782 for (i = PART_BEG; i < RC_COUNT; i++)
1787 { 1783 {
1788 MIN_IT (rc[i].col, ncol - 1); 1784 min_it (rc[i].col, ncol - 1);
1789 MIN_IT (rc[i].row, nrow - 1); 1785 min_it (rc[i].row, nrow - 1);
1790 } 1786 }
1791 1787
1792 for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++) 1788 for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++)
1793 fill_text (&drawn[i].t[rc[PART_BEG].col], 0, rc[PART_END].col - rc[PART_BEG].col + 1); 1789 fill_text (&drawn[i].t[rc[PART_BEG].col], 0, rc[PART_END].col - rc[PART_BEG].col + 1);
1794 1790
1961{ 1957{
1962 unsigned char must_clear, /* use draw_string not draw_image_string */ 1958 unsigned char must_clear, /* use draw_string not draw_image_string */
1963 showcursor; /* show the cursor */ 1959 showcursor; /* show the cursor */
1964 int16_t col, row, /* column/row we're processing */ 1960 int16_t col, row, /* column/row we're processing */
1965 ocrow; /* old cursor row */ 1961 ocrow; /* old cursor row */
1966 int i, /* tmp */ 1962 int i; /* tmp */
1967 row_offset; /* basic offset in screen structure */
1968#ifndef NO_CURSORCOLOR 1963#ifndef NO_CURSORCOLOR
1969 rend_t cc1; /* store colours at cursor position (s) */ 1964 rend_t cc1; /* store colours at cursor position (s) */
1970#endif 1965#endif
1971 rend_t *crp; // cursor rendition pointer 1966 rend_t *crp; // cursor rendition pointer
1972 1967
1978 /* 1973 /*
1979 * A: set up vars 1974 * A: set up vars
1980 */ 1975 */
1981 must_clear = 0; 1976 must_clear = 0;
1982 refresh_count = 0; 1977 refresh_count = 0;
1983
1984 row_offset = term_start - view_start;
1985 1978
1986#if XPM_BACKGROUND 1979#if XPM_BACKGROUND
1987 must_clear |= bgPixmap.pixmap != None; 1980 must_clear |= bgPixmap.pixmap != None;
1988#endif 1981#endif
1989#if TRANSPARENT 1982#if TRANSPARENT
2107 row = i > 0 ? 0 : j - 1; 2100 row = i > 0 ? 0 : j - 1;
2108 for (; j-- >= 0; row += (i > 0 ? 1 : -1)) 2101 for (; j-- >= 0; row += (i > 0 ? 1 : -1))
2109 { 2102 {
2110 if (row + i >= 0 && row + i < nrow && row + i != ocrow) 2103 if (row + i >= 0 && row + i < nrow && row + i != ocrow)
2111 { 2104 {
2112 line_t s = save[(row + row_offset) % total_rows]; 2105 line_t s = ROW(row - view_start);
2113 line_t d = drawn[row]; 2106 line_t d = drawn[row];
2114 line_t d2 = drawn[row + i]; 2107 line_t d2 = drawn[row + i];
2115 2108
2116 for (nits = 0, col = ncol; col--; ) 2109 for (nits = 0, col = ncol; col--; )
2117 if (s.t[col] != d2.t[col] || s.r[col] != d2.r[col]) 2110 if (s.t[col] != d2.t[col] || s.r[col] != d2.r[col])
2137 2130
2138 if (len != -1) 2131 if (len != -1)
2139 { 2132 {
2140 /* also comes here at end if needed because of >= above */ 2133 /* also comes here at end if needed because of >= above */
2141 if (wlen < len) 2134 if (wlen < len)
2142 SWAP_IT (wlen, len, int); 2135 ::swap (wlen, len);
2143 2136
2144 XCopyArea (display->display, vt, vt, 2137 XCopyArea (display->display, vt, vt,
2145 gc, 0, Row2Pixel (len + i), 2138 gc, 0, Row2Pixel (len + i),
2146 (unsigned int)TermWin_TotalWidth (), 2139 (unsigned int)TermWin_TotalWidth (),
2147 (unsigned int)Height2Pixel (wlen - len + 1), 2140 (unsigned int)Height2Pixel (wlen - len + 1),
2155 /* 2148 /*
2156 * E: main pass across every character 2149 * E: main pass across every character
2157 */ 2150 */
2158 for (row = 0; row < nrow; row++) 2151 for (row = 0; row < nrow; row++)
2159 { 2152 {
2160 text_t *stp = save[(row + row_offset) % total_rows].t; 2153 text_t *stp = ROW(row - view_start).t;
2161 rend_t *srp = save[(row + row_offset) % total_rows].r; 2154 rend_t *srp = ROW(row - view_start).r;
2162 text_t *dtp = drawn[row].t; 2155 text_t *dtp = drawn[row].t;
2163 rend_t *drp = drawn[row].r; 2156 rend_t *drp = drawn[row].r;
2164 2157
2165 /* 2158 /*
2166 * E2: OK, now the real pass 2159 * E2: OK, now the real pass
2279 fore = Color_UL; 2272 fore = Color_UL;
2280#endif 2273#endif
2281 2274
2282 if (invert) 2275 if (invert)
2283 { 2276 {
2284 SWAP_IT (fore, back, int); 2277 ::swap (fore, back);
2285 2278
2286#ifndef NO_BOLD_UNDERLINE_REVERSE 2279#ifndef NO_BOLD_UNDERLINE_REVERSE
2287 if (ISSET_PIXCOLOR (Color_RV)) 2280 if (ISSET_PIXCOLOR (Color_RV))
2288 back = Color_RV; 2281 back = Color_RV;
2289 2282
3031 want_refresh = 1; 3024 want_refresh = 1;
3032 3025
3033 selection.mark.row = row - view_start; 3026 selection.mark.row = row - view_start;
3034 selection.mark.col = col; 3027 selection.mark.col = col;
3035 3028
3036 selection.mark.row = min (max (selection.mark.row, -nsaved), nrow - 1); 3029 selection.mark.row = clamp (selection.mark.row, -nsaved, nrow - 1);
3037 selection.mark.col = min (max (selection.mark.col, 0), ncol - 1); 3030 selection.mark.col = clamp (selection.mark.col, 0, ncol - 1);
3038 3031
3039 while (selection.mark.col > 0 3032 while (selection.mark.col > 0
3040 && ROW(selection.mark.row).t[selection.mark.col] == NOCHAR) 3033 && ROW(selection.mark.row).t[selection.mark.col] == NOCHAR)
3041 --selection.mark.col; 3034 --selection.mark.col;
3042 3035
3147 * flag == 2 ==> button 3 motion 3140 * flag == 2 ==> button 3 motion
3148 */ 3141 */
3149void 3142void
3150rxvt_term::selection_extend (int x, int y, int flag) 3143rxvt_term::selection_extend (int x, int y, int flag)
3151{ 3144{
3152 int col = min (max (Pixel2Col (x), 0), nrow - 1); 3145 int col = clamp (Pixel2Col (x), 0, ncol);
3153 int row = min (max (Pixel2Row (y), 0), ncol); 3146 int row = clamp (Pixel2Row (y), 0, nrow - 1);
3154 3147
3155 /* 3148 /*
3156 * If we're selecting characters (single click) then we must check first 3149 * If we're selecting characters (single click) then we must check first
3157 * if we are at the same place as the original mark. If we are then 3150 * if we are at the same place as the original mark. If we are then
3158 * select nothing. Otherwise, if we're to the right of the mark, you have to 3151 * select nothing. Otherwise, if we're to the right of the mark, you have to
3371 } 3364 }
3372 } 3365 }
3373 3366
3374#if ENABLE_FRILLS 3367#if ENABLE_FRILLS
3375 if (selection.rect && selection.beg.col > selection.end.col) 3368 if (selection.rect && selection.beg.col > selection.end.col)
3376 SWAP_IT (selection.beg.col, selection.end.col, int); 3369 ::swap (selection.beg.col, selection.end.col);
3377#endif 3370#endif
3378} 3371}
3379 3372
3380#if ENABLE_FRILLS 3373#if ENABLE_FRILLS
3381void 3374void
3579 */ 3572 */
3580void 3573void
3581rxvt_term::pixel_position (int *x, int *y) 3574rxvt_term::pixel_position (int *x, int *y)
3582{ 3575{
3583 *x = Pixel2Col (*x); 3576 *x = Pixel2Col (*x);
3584 /* MAX_IT (*x, 0); MIN_IT (*x, (int)ncol - 1); */ 3577 /* max_it (*x, 0); min_it (*x, (int)ncol - 1); */
3585 *y = Pixel2Row (*y); 3578 *y = Pixel2Row (*y);
3586 /* MAX_IT (*y, 0); MIN_IT (*y, (int)nrow - 1); */ 3579 /* max_it (*y, 0); min_it (*y, (int)nrow - 1); */
3587} 3580}
3588 3581
3589/* ------------------------------------------------------------------------- */ 3582/* ------------------------------------------------------------------------- */
3590#ifdef USE_XIM 3583#ifdef USE_XIM
3591void 3584void
3613 3606
3614 if (x < 0) x = ncol - w; 3607 if (x < 0) x = ncol - w;
3615 if (y < 0) y = nrow - h; 3608 if (y < 0) y = nrow - h;
3616 3609
3617 // make space for border 3610 // make space for border
3618 w += 2; MIN_IT (w, ncol); 3611 w += 2; min_it (w, ncol);
3619 h += 2; MIN_IT (h, nrow); 3612 h += 2; min_it (h, nrow);
3620 3613
3621 x -= 1; MAX_IT (x, 0); 3614 x -= 1; max_it (x, 0);
3622 y -= 1; MAX_IT (y, 0); 3615 y -= 1; max_it (y, 0);
3623 3616
3624 MIN_IT (x, ncol - w); 3617 min_it (x, ncol - w);
3625 MIN_IT (y, nrow - h); 3618 min_it (y, nrow - h);
3626 3619
3627 ov_x = x; ov_y = y; 3620 ov_x = x; ov_y = y;
3628 ov_w = w; ov_h = h; 3621 ov_w = w; ov_h = h;
3629 3622
3630 ov_text = new text_t *[h]; 3623 ov_text = new text_t *[h];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines