… | |
… | |
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 | { |
… | |
… | |
1482 | scr_blank_line (*line, ncol - count, count, tr); |
1478 | scr_blank_line (*line, ncol - count, count, tr); |
1483 | |
1479 | |
1484 | if (line->is_longer ()) /* break line continuation */ |
1480 | if (line->is_longer ()) /* break line continuation */ |
1485 | line->l = ncol; |
1481 | line->l = ncol; |
1486 | |
1482 | |
1487 | line->l = max (line->l - count, 0); |
1483 | max_it (line->l - count, 0); |
1488 | |
1484 | |
1489 | if (selection.op && current_screen == selection.screen |
1485 | if (selection.op && current_screen == selection.screen |
1490 | && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) |
1486 | && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) |
1491 | { |
1487 | { |
1492 | if (selection.end.row != screen.cur.row |
1488 | if (selection.end.row != screen.cur.row |
… | |
… | |
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 | */ |
1514 | void |
1510 | void |
1515 | rxvt_term::scr_scroll_region (int top, int bot) |
1511 | rxvt_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) |
… | |
… | |
1767 | eheight = height; |
1763 | eheight = height; |
1768 | } |
1764 | } |
1769 | #endif |
1765 | #endif |
1770 | |
1766 | |
1771 | #ifdef DEBUG_STRICT |
1767 | #ifdef DEBUG_STRICT |
1772 | x = max (x, 0); |
1768 | #if 0 |
1773 | x = min (x, (int)width); |
1769 | // that's not debugging //TODO //FIXME |
1774 | y = max (y, 0); |
1770 | clamp_it (x, 0, width); |
1775 | y = min (y, (int)height); |
1771 | clamp_it (y, 0, height); |
|
|
1772 | #endif |
1776 | #endif |
1773 | #endif |
1777 | |
1774 | |
1778 | /* round down */ |
1775 | /* round down */ |
1779 | rc[PART_BEG].col = Pixel2Col (x); |
1776 | rc[PART_BEG].col = Pixel2Col (x); |
1780 | rc[PART_BEG].row = Pixel2Row (y); |
1777 | rc[PART_BEG].row = Pixel2Row (y); |
… | |
… | |
1783 | rc[PART_END].row = Pixel2Row (y + eheight + fheight - 1); |
1780 | rc[PART_END].row = Pixel2Row (y + eheight + fheight - 1); |
1784 | |
1781 | |
1785 | /* sanity checks */ |
1782 | /* sanity checks */ |
1786 | for (i = PART_BEG; i < RC_COUNT; i++) |
1783 | for (i = PART_BEG; i < RC_COUNT; i++) |
1787 | { |
1784 | { |
1788 | MIN_IT (rc[i].col, ncol - 1); |
1785 | min_it (rc[i].col, ncol - 1); |
1789 | MIN_IT (rc[i].row, nrow - 1); |
1786 | min_it (rc[i].row, nrow - 1); |
1790 | } |
1787 | } |
1791 | |
1788 | |
1792 | 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++) |
1793 | 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); |
1794 | |
1791 | |
… | |
… | |
1961 | { |
1958 | { |
1962 | unsigned char must_clear, /* use draw_string not draw_image_string */ |
1959 | unsigned char must_clear, /* use draw_string not draw_image_string */ |
1963 | showcursor; /* show the cursor */ |
1960 | showcursor; /* show the cursor */ |
1964 | int16_t col, row, /* column/row we're processing */ |
1961 | int16_t col, row, /* column/row we're processing */ |
1965 | ocrow; /* old cursor row */ |
1962 | ocrow; /* old cursor row */ |
1966 | int i, /* tmp */ |
1963 | int i; /* tmp */ |
1967 | row_offset; /* basic offset in screen structure */ |
|
|
1968 | #ifndef NO_CURSORCOLOR |
1964 | #ifndef NO_CURSORCOLOR |
1969 | rend_t cc1; /* store colours at cursor position (s) */ |
1965 | rend_t cc1; /* store colours at cursor position (s) */ |
1970 | #endif |
1966 | #endif |
1971 | rend_t *crp; // cursor rendition pointer |
1967 | rend_t *crp; // cursor rendition pointer |
1972 | |
1968 | |
… | |
… | |
1978 | /* |
1974 | /* |
1979 | * A: set up vars |
1975 | * A: set up vars |
1980 | */ |
1976 | */ |
1981 | must_clear = 0; |
1977 | must_clear = 0; |
1982 | refresh_count = 0; |
1978 | refresh_count = 0; |
1983 | |
|
|
1984 | row_offset = term_start - view_start; |
|
|
1985 | |
1979 | |
1986 | #if XPM_BACKGROUND |
1980 | #if XPM_BACKGROUND |
1987 | must_clear |= bgPixmap.pixmap != None; |
1981 | must_clear |= bgPixmap.pixmap != None; |
1988 | #endif |
1982 | #endif |
1989 | #if TRANSPARENT |
1983 | #if TRANSPARENT |
… | |
… | |
2107 | row = i > 0 ? 0 : j - 1; |
2101 | row = i > 0 ? 0 : j - 1; |
2108 | for (; j-- >= 0; row += (i > 0 ? 1 : -1)) |
2102 | for (; j-- >= 0; row += (i > 0 ? 1 : -1)) |
2109 | { |
2103 | { |
2110 | if (row + i >= 0 && row + i < nrow && row + i != ocrow) |
2104 | if (row + i >= 0 && row + i < nrow && row + i != ocrow) |
2111 | { |
2105 | { |
2112 | line_t s = save[(row + row_offset) % total_rows]; |
2106 | line_t s = ROW(row - view_start); |
2113 | line_t d = drawn[row]; |
2107 | line_t d = drawn[row]; |
2114 | line_t d2 = drawn[row + i]; |
2108 | line_t d2 = drawn[row + i]; |
2115 | |
2109 | |
2116 | for (nits = 0, col = ncol; col--; ) |
2110 | for (nits = 0, col = ncol; col--; ) |
2117 | 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]) |
… | |
… | |
2137 | |
2131 | |
2138 | if (len != -1) |
2132 | if (len != -1) |
2139 | { |
2133 | { |
2140 | /* also comes here at end if needed because of >= above */ |
2134 | /* also comes here at end if needed because of >= above */ |
2141 | if (wlen < len) |
2135 | if (wlen < len) |
2142 | SWAP_IT (wlen, len, int); |
2136 | ::swap (wlen, len); |
2143 | |
2137 | |
2144 | XCopyArea (display->display, vt, vt, |
2138 | XCopyArea (display->display, vt, vt, |
2145 | gc, 0, Row2Pixel (len + i), |
2139 | gc, 0, Row2Pixel (len + i), |
2146 | (unsigned int)TermWin_TotalWidth (), |
2140 | (unsigned int)TermWin_TotalWidth (), |
2147 | (unsigned int)Height2Pixel (wlen - len + 1), |
2141 | (unsigned int)Height2Pixel (wlen - len + 1), |
… | |
… | |
2155 | /* |
2149 | /* |
2156 | * E: main pass across every character |
2150 | * E: main pass across every character |
2157 | */ |
2151 | */ |
2158 | for (row = 0; row < nrow; row++) |
2152 | for (row = 0; row < nrow; row++) |
2159 | { |
2153 | { |
2160 | text_t *stp = save[(row + row_offset) % total_rows].t; |
2154 | text_t *stp = ROW(row - view_start).t; |
2161 | rend_t *srp = save[(row + row_offset) % total_rows].r; |
2155 | rend_t *srp = ROW(row - view_start).r; |
2162 | text_t *dtp = drawn[row].t; |
2156 | text_t *dtp = drawn[row].t; |
2163 | rend_t *drp = drawn[row].r; |
2157 | rend_t *drp = drawn[row].r; |
2164 | |
2158 | |
2165 | /* |
2159 | /* |
2166 | * E2: OK, now the real pass |
2160 | * E2: OK, now the real pass |
… | |
… | |
2279 | fore = Color_UL; |
2273 | fore = Color_UL; |
2280 | #endif |
2274 | #endif |
2281 | |
2275 | |
2282 | if (invert) |
2276 | if (invert) |
2283 | { |
2277 | { |
2284 | SWAP_IT (fore, back, int); |
2278 | ::swap (fore, back); |
2285 | |
2279 | |
2286 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
2280 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
2287 | if (ISSET_PIXCOLOR (Color_RV)) |
2281 | if (ISSET_PIXCOLOR (Color_RV)) |
2288 | back = Color_RV; |
2282 | back = Color_RV; |
2289 | |
2283 | |
… | |
… | |
3031 | want_refresh = 1; |
3025 | want_refresh = 1; |
3032 | |
3026 | |
3033 | selection.mark.row = row - view_start; |
3027 | selection.mark.row = row - view_start; |
3034 | selection.mark.col = col; |
3028 | selection.mark.col = col; |
3035 | |
3029 | |
3036 | selection.mark.row = min (max (selection.mark.row, -nsaved), nrow - 1); |
3030 | selection.mark.row = clamp (selection.mark.row, -nsaved, nrow - 1); |
3037 | selection.mark.col = min (max (selection.mark.col, 0), ncol - 1); |
3031 | selection.mark.col = clamp (selection.mark.col, 0, ncol - 1); |
3038 | |
3032 | |
3039 | while (selection.mark.col > 0 |
3033 | while (selection.mark.col > 0 |
3040 | && ROW(selection.mark.row).t[selection.mark.col] == NOCHAR) |
3034 | && ROW(selection.mark.row).t[selection.mark.col] == NOCHAR) |
3041 | --selection.mark.col; |
3035 | --selection.mark.col; |
3042 | |
3036 | |
… | |
… | |
3147 | * flag == 2 ==> button 3 motion |
3141 | * flag == 2 ==> button 3 motion |
3148 | */ |
3142 | */ |
3149 | void |
3143 | void |
3150 | rxvt_term::selection_extend (int x, int y, int flag) |
3144 | rxvt_term::selection_extend (int x, int y, int flag) |
3151 | { |
3145 | { |
3152 | int col = min (max (Pixel2Col (x), 0), nrow - 1); |
3146 | int col = clamp (Pixel2Col (x), 0, ncol); |
3153 | int row = min (max (Pixel2Row (y), 0), ncol); |
3147 | int row = clamp (Pixel2Row (y), 0, nrow - 1); |
3154 | |
3148 | |
3155 | /* |
3149 | /* |
3156 | * 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 |
3157 | * 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 |
3158 | * 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 |
… | |
… | |
3371 | } |
3365 | } |
3372 | } |
3366 | } |
3373 | |
3367 | |
3374 | #if ENABLE_FRILLS |
3368 | #if ENABLE_FRILLS |
3375 | if (selection.rect && selection.beg.col > selection.end.col) |
3369 | if (selection.rect && selection.beg.col > selection.end.col) |
3376 | SWAP_IT (selection.beg.col, selection.end.col, int); |
3370 | ::swap (selection.beg.col, selection.end.col); |
3377 | #endif |
3371 | #endif |
3378 | } |
3372 | } |
3379 | |
3373 | |
3380 | #if ENABLE_FRILLS |
3374 | #if ENABLE_FRILLS |
3381 | void |
3375 | void |
… | |
… | |
3579 | */ |
3573 | */ |
3580 | void |
3574 | void |
3581 | rxvt_term::pixel_position (int *x, int *y) |
3575 | rxvt_term::pixel_position (int *x, int *y) |
3582 | { |
3576 | { |
3583 | *x = Pixel2Col (*x); |
3577 | *x = Pixel2Col (*x); |
3584 | /* MAX_IT (*x, 0); MIN_IT (*x, (int)ncol - 1); */ |
3578 | /* max_it (*x, 0); min_it (*x, (int)ncol - 1); */ |
3585 | *y = Pixel2Row (*y); |
3579 | *y = Pixel2Row (*y); |
3586 | /* MAX_IT (*y, 0); MIN_IT (*y, (int)nrow - 1); */ |
3580 | /* max_it (*y, 0); min_it (*y, (int)nrow - 1); */ |
3587 | } |
3581 | } |
3588 | |
3582 | |
3589 | /* ------------------------------------------------------------------------- */ |
3583 | /* ------------------------------------------------------------------------- */ |
3590 | #ifdef USE_XIM |
3584 | #ifdef USE_XIM |
3591 | void |
3585 | void |
… | |
… | |
3613 | |
3607 | |
3614 | if (x < 0) x = ncol - w; |
3608 | if (x < 0) x = ncol - w; |
3615 | if (y < 0) y = nrow - h; |
3609 | if (y < 0) y = nrow - h; |
3616 | |
3610 | |
3617 | // make space for border |
3611 | // make space for border |
3618 | w += 2; MIN_IT (w, ncol); |
3612 | w += 2; min_it (w, ncol); |
3619 | h += 2; MIN_IT (h, nrow); |
3613 | h += 2; min_it (h, nrow); |
3620 | |
3614 | |
3621 | x -= 1; MAX_IT (x, 0); |
3615 | x -= 1; max_it (x, 0); |
3622 | y -= 1; MAX_IT (y, 0); |
3616 | y -= 1; max_it (y, 0); |
3623 | |
3617 | |
3624 | MIN_IT (x, ncol - w); |
3618 | min_it (x, ncol - w); |
3625 | MIN_IT (y, nrow - h); |
3619 | min_it (y, nrow - h); |
3626 | |
3620 | |
3627 | ov_x = x; ov_y = y; |
3621 | ov_x = x; ov_y = y; |
3628 | ov_w = w; ov_h = h; |
3622 | ov_w = w; ov_h = h; |
3629 | |
3623 | |
3630 | ov_text = new text_t *[h]; |
3624 | ov_text = new text_t *[h]; |