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.178 by root, Tue Dec 20 22:27:49 2005 UTC vs.
Revision 1.185 by root, Wed Dec 21 14:25:41 2005 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines