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.182 by root, Wed Dec 21 10:35:47 2005 UTC vs.
Revision 1.183 by root, Wed Dec 21 14:19:19 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/*
745#ifdef DEBUG_STRICT 745#ifdef DEBUG_STRICT
746 assert (screen.cur.col < last_col); 746 assert (screen.cur.col < last_col);
747 assert ((screen.cur.row < nrow) 747 assert ((screen.cur.row < nrow)
748 && (screen.cur.row >= - (int32_t)nsaved)); 748 && (screen.cur.row >= - (int32_t)nsaved));
749#else /* drive with your eyes closed */ 749#else /* drive with your eyes closed */
750 MIN_IT (screen.cur.col, last_col - 1); 750 min_it (screen.cur.col, last_col - 1);
751 MIN_IT (screen.cur.row, (int32_t)nrow - 1); 751 min_it (screen.cur.row, (int32_t)nrow - 1);
752 MAX_IT (screen.cur.row, - (int32_t)nsaved); 752 max_it (screen.cur.row, - (int32_t)nsaved);
753#endif 753#endif
754 row = screen.cur.row; 754 row = screen.cur.row;
755 755
756 checksel = selection.op && current_screen == selection.screen ? 1 : 0; 756 checksel = selection.op && current_screen == selection.screen ? 1 : 0;
757 757
763 763
764 if (c < 0x20) 764 if (c < 0x20)
765 if (c == C0_LF) 765 if (c == C0_LF)
766 { 766 {
767 if (!line->is_longer ()) /* XXX: think about this */ 767 if (!line->is_longer ()) /* XXX: think about this */
768 MAX_IT (line->l, screen.cur.col); 768 max_it (line->l, screen.cur.col);
769 769
770 screen.flags &= ~Screen_WrapNext; 770 screen.flags &= ~Screen_WrapNext;
771 771
772 if (screen.cur.row == screen.bscroll) 772 if (screen.cur.row == screen.bscroll)
773 scr_scroll_text (screen.tscroll, screen.bscroll, 1); 773 scr_scroll_text (screen.tscroll, screen.bscroll, 1);
778 continue; 778 continue;
779 } 779 }
780 else if (c == C0_CR) 780 else if (c == C0_CR)
781 { 781 {
782 if (!line->is_longer ()) /* XXX: think about this */ 782 if (!line->is_longer ()) /* XXX: think about this */
783 MAX_IT (line->l, screen.cur.col); 783 max_it (line->l, screen.cur.col);
784 784
785 screen.flags &= ~Screen_WrapNext; 785 screen.flags &= ~Screen_WrapNext;
786 screen.cur.col = 0; 786 screen.cur.col = 0;
787 continue; 787 continue;
788 } 788 }
964#endif 964#endif
965 } 965 }
966 } 966 }
967 967
968 if (!line->is_longer ()) /* XXX: think about this */ 968 if (!line->is_longer ()) /* XXX: think about this */
969 MAX_IT (line->l, screen.cur.col); 969 max_it (line->l, screen.cur.col);
970 970
971#ifdef DEBUG_STRICT 971#ifdef DEBUG_STRICT
972 assert (screen.cur.row >= 0); 972 assert (screen.cur.row >= 0);
973#else /* drive with your eyes closed */ 973#else /* drive with your eyes closed */
974 MAX_IT (screen.cur.row, 0); 974 max_it (screen.cur.row, 0);
975#endif 975#endif
976} 976}
977 977
978/* ------------------------------------------------------------------------- */ 978/* ------------------------------------------------------------------------- */
979/* 979/*
1045 if (ht && options & Opt_pastableTabs) 1045 if (ht && options & Opt_pastableTabs)
1046 { 1046 {
1047 base_rend = SET_FONT (base_rend, 0); 1047 base_rend = SET_FONT (base_rend, 0);
1048 1048
1049 if (!l.is_longer ()) /* XXX: think about this */ 1049 if (!l.is_longer ()) /* XXX: think about this */
1050 MAX_IT (l.l, x); 1050 max_it (l.l, x);
1051 1051
1052 i = screen.cur.col; 1052 i = screen.cur.col;
1053 1053
1054 l.t[i] = '\t'; 1054 l.t[i] = '\t';
1055 l.r[i] = base_rend; 1055 l.r[i] = base_rend;
1134{ 1134{
1135 want_refresh = 1; 1135 want_refresh = 1;
1136 ZERO_SCROLLBACK (); 1136 ZERO_SCROLLBACK ();
1137 1137
1138 screen.cur.col = relative & C_RELATIVE ? screen.cur.col + col : col; 1138 screen.cur.col = relative & C_RELATIVE ? screen.cur.col + col : col;
1139 MAX_IT (screen.cur.col, 0); 1139 max_it (screen.cur.col, 0);
1140 MIN_IT (screen.cur.col, (int32_t)ncol - 1); 1140 min_it (screen.cur.col, (int32_t)ncol - 1);
1141 1141
1142 screen.flags &= ~Screen_WrapNext; 1142 screen.flags &= ~Screen_WrapNext;
1143 1143
1144 if (relative & R_RELATIVE) 1144 if (relative & R_RELATIVE)
1145 { 1145 {
1163 else 1163 else
1164 { 1164 {
1165 if (screen.flags & Screen_Relative) 1165 if (screen.flags & Screen_Relative)
1166 { /* relative origin mode */ 1166 { /* relative origin mode */
1167 screen.cur.row = row + screen.tscroll; 1167 screen.cur.row = row + screen.tscroll;
1168 MIN_IT (screen.cur.row, screen.bscroll); 1168 min_it (screen.cur.row, screen.bscroll);
1169 } 1169 }
1170 else 1170 else
1171 screen.cur.row = row; 1171 screen.cur.row = row;
1172 } 1172 }
1173 1173
1174 MAX_IT (screen.cur.row, 0); 1174 max_it (screen.cur.row, 0);
1175 MIN_IT (screen.cur.row, (int32_t)nrow - 1); 1175 min_it (screen.cur.row, (int32_t)nrow - 1);
1176} 1176}
1177 1177
1178/* ------------------------------------------------------------------------- */ 1178/* ------------------------------------------------------------------------- */
1179/* 1179/*
1180 * direction should be UP or DN 1180 * direction should be UP or DN
1195 || (screen.cur.row == screen.tscroll && direction == DN)) 1195 || (screen.cur.row == screen.tscroll && direction == DN))
1196 scr_scroll_text (screen.tscroll, screen.bscroll, dirn); 1196 scr_scroll_text (screen.tscroll, screen.bscroll, dirn);
1197 else 1197 else
1198 screen.cur.row += dirn; 1198 screen.cur.row += dirn;
1199 1199
1200 MAX_IT (screen.cur.row, 0); 1200 max_it (screen.cur.row, 0);
1201 MIN_IT (screen.cur.row, (int32_t)nrow - 1); 1201 min_it (screen.cur.row, (int32_t)nrow - 1);
1202 selection_check (0); 1202 selection_check (0);
1203} 1203}
1204 1204
1205/* ------------------------------------------------------------------------- */ 1205/* ------------------------------------------------------------------------- */
1206/* 1206/*
1224 switch (mode) 1224 switch (mode)
1225 { 1225 {
1226 case 0: /* erase to end of line */ 1226 case 0: /* erase to end of line */
1227 col = screen.cur.col; 1227 col = screen.cur.col;
1228 num = ncol - col; 1228 num = ncol - col;
1229 MIN_IT (ROW(row).l, (int16_t)col); 1229 min_it (ROW(row).l, (int16_t)col);
1230 if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) 1230 if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)
1231 || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) 1231 || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur))
1232 CLEAR_SELECTION (); 1232 CLEAR_SELECTION ();
1233 break; 1233 break;
1234 case 1: /* erase to beginning of line */ 1234 case 1: /* erase to beginning of line */
1301 CLEAR_SELECTION (); 1301 CLEAR_SELECTION ();
1302 1302
1303 if (row >= nrow) /* Out Of Bounds */ 1303 if (row >= nrow) /* Out Of Bounds */
1304 return; 1304 return;
1305 1305
1306 MIN_IT (num, (nrow - row)); 1306 min_it (num, (nrow - row));
1307 1307
1308 if (rstyle & (RS_RVid | RS_Uline)) 1308 if (rstyle & (RS_RVid | RS_Uline))
1309 ren = (rend_t) ~RS_None; 1309 ren = (rend_t) ~RS_None;
1310 else if (GET_BASEBG (rstyle) == Color_bg) 1310 else if (GET_BASEBG (rstyle) == Color_bg)
1311 { 1311 {
1419 return; 1419 return;
1420 1420
1421 scr_do_wrap (); 1421 scr_do_wrap ();
1422 1422
1423 selection_check (1); 1423 selection_check (1);
1424 MIN_IT (count, (ncol - screen.cur.col)); 1424 min_it (count, (ncol - screen.cur.col));
1425 1425
1426 row = screen.cur.row; 1426 row = screen.cur.row;
1427 1427
1428 line_t *line = &ROW(row); 1428 line_t *line = &ROW(row);
1429 1429
1437 } 1437 }
1438 1438
1439 if (!line->is_longer ()) 1439 if (!line->is_longer ())
1440 { 1440 {
1441 line->l += count; 1441 line->l += count;
1442 MIN_IT (line->l, ncol); 1442 min_it (line->l, ncol);
1443 } 1443 }
1444 1444
1445 if (selection.op && current_screen == selection.screen 1445 if (selection.op && current_screen == selection.screen
1446 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) 1446 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur))
1447 { 1447 {
1508 * XTERM_SEQ: Set region <top> - <bot> inclusive: ESC [ <top> ; <bot> r 1508 * XTERM_SEQ: Set region <top> - <bot> inclusive: ESC [ <top> ; <bot> r
1509 */ 1509 */
1510void 1510void
1511rxvt_term::scr_scroll_region (int top, int bot) 1511rxvt_term::scr_scroll_region (int top, int bot)
1512{ 1512{
1513 MAX_IT (top, 0); 1513 max_it (top, 0);
1514 MIN_IT (bot, (int)nrow - 1); 1514 min_it (bot, (int)nrow - 1);
1515 1515
1516 if (top > bot) 1516 if (top > bot)
1517 return; 1517 return;
1518 1518
1519 screen.tscroll = top; 1519 screen.tscroll = top;
1779 rc[PART_END].row = Pixel2Row (y + eheight + fheight - 1); 1779 rc[PART_END].row = Pixel2Row (y + eheight + fheight - 1);
1780 1780
1781 /* sanity checks */ 1781 /* sanity checks */
1782 for (i = PART_BEG; i < RC_COUNT; i++) 1782 for (i = PART_BEG; i < RC_COUNT; i++)
1783 { 1783 {
1784 MIN_IT (rc[i].col, ncol - 1); 1784 min_it (rc[i].col, ncol - 1);
1785 MIN_IT (rc[i].row, nrow - 1); 1785 min_it (rc[i].row, nrow - 1);
1786 } 1786 }
1787 1787
1788 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++)
1789 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);
1790 1790
3572 */ 3572 */
3573void 3573void
3574rxvt_term::pixel_position (int *x, int *y) 3574rxvt_term::pixel_position (int *x, int *y)
3575{ 3575{
3576 *x = Pixel2Col (*x); 3576 *x = Pixel2Col (*x);
3577 /* MAX_IT (*x, 0); MIN_IT (*x, (int)ncol - 1); */ 3577 /* max_it (*x, 0); min_it (*x, (int)ncol - 1); */
3578 *y = Pixel2Row (*y); 3578 *y = Pixel2Row (*y);
3579 /* MAX_IT (*y, 0); MIN_IT (*y, (int)nrow - 1); */ 3579 /* max_it (*y, 0); min_it (*y, (int)nrow - 1); */
3580} 3580}
3581 3581
3582/* ------------------------------------------------------------------------- */ 3582/* ------------------------------------------------------------------------- */
3583#ifdef USE_XIM 3583#ifdef USE_XIM
3584void 3584void
3606 3606
3607 if (x < 0) x = ncol - w; 3607 if (x < 0) x = ncol - w;
3608 if (y < 0) y = nrow - h; 3608 if (y < 0) y = nrow - h;
3609 3609
3610 // make space for border 3610 // make space for border
3611 w += 2; MIN_IT (w, ncol); 3611 w += 2; min_it (w, ncol);
3612 h += 2; MIN_IT (h, nrow); 3612 h += 2; min_it (h, nrow);
3613 3613
3614 x -= 1; MAX_IT (x, 0); 3614 x -= 1; max_it (x, 0);
3615 y -= 1; MAX_IT (y, 0); 3615 y -= 1; max_it (y, 0);
3616 3616
3617 MIN_IT (x, ncol - w); 3617 min_it (x, ncol - w);
3618 MIN_IT (y, nrow - h); 3618 min_it (y, nrow - h);
3619 3619
3620 ov_x = x; ov_y = y; 3620 ov_x = x; ov_y = y;
3621 ov_w = w; ov_h = h; 3621 ov_w = w; ov_h = h;
3622 3622
3623 ov_text = new text_t *[h]; 3623 ov_text = new text_t *[h];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines