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.191 by root, Thu Dec 22 18:36:55 2005 UTC vs.
Revision 1.194 by root, Mon Dec 26 21:30:04 2005 UTC

283 // to come up with a lean and mean algorithm. 283 // to come up with a lean and mean algorithm.
284 284
285 row_col_t ocur = screen.cur; 285 row_col_t ocur = screen.cur;
286 ocur.row = MOD (term_start + ocur.row, prev_total_rows); 286 ocur.row = MOD (term_start + ocur.row, prev_total_rows);
287 287
288 while (p != pend && q > 0) 288 do
289 { 289 {
290 p = MOD (p - 1, prev_total_rows); 290 p = MOD (p - 1, prev_total_rows);
291#ifdef DEBUG_STRICT 291#ifdef DEBUG_STRICT
292 assert (old_buf [MOD (p, prev_total_rows)].t); 292 assert (old_buf [MOD (p, prev_total_rows)].t);
293#endif 293#endif
354 } 354 }
355 355
356 qline->l = llen < ncol ? llen : MOD (llen - 1, ncol) + 1; 356 qline->l = llen < ncol ? llen : MOD (llen - 1, ncol) + 1;
357 scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE); 357 scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE);
358 } 358 }
359 while (p != pend && q > 0);
359 360
360 term_start = total_rows - nrow; 361 term_start = total_rows - nrow;
361 view_start = 0;
362 nsaved = term_start - q; 362 nsaved = term_start - q;
363 363
364 // make sure all terminal lines exist 364 // make sure all terminal lines exist
365 while (nsaved < 0) 365 while (nsaved < 0)
366 scr_blank_screen_mem (ROW (-++nsaved), DEFAULT_RSTYLE); 366 scr_blank_screen_mem (ROW (-++nsaved), DEFAULT_RSTYLE);
383 { 383 {
384 row_buf [row].clear (); scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE); 384 row_buf [row].clear (); scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE);
385 } 385 }
386 386
387 term_start = 0; 387 term_start = 0;
388 view_start = 0;
389 } 388 }
390 389
391#ifdef DEBUG_STRICT 390#ifdef DEBUG_STRICT //TODO: remove
392 for (int i = -nsaved; i < nrow; i++) 391 for (int i = -nsaved; i < nrow; i++)
393 assert (ROW (i).t); 392 assert (ROW (i).t);
394#endif 393#endif
395 394
396 free (old_buf); 395 free (old_buf);
621 { 620 {
622 selection.beg.row -= count; 621 selection.beg.row -= count;
623 selection.end.row -= count; 622 selection.end.row -= count;
624 selection.mark.row -= count; 623 selection.mark.row -= count;
625 624
626 selection_check (0); 625 if (selection.beg.row < -nsaved
626 || selection.end.row < -nsaved
627 || selection.mark.row < -nsaved)
628 {
629 CLEAR_ALL_SELECTION ();
630 selection.op = SELECTION_CLEAR;
631 }
627 } 632 }
628 633
629 for (int i = count; i--; ) 634 for (int i = count; i--; )
630 scr_blank_screen_mem (ROW(row2 - i), rstyle); 635 scr_blank_screen_mem (ROW(row2 - i), rstyle);
631 636
636 } 641 }
637 else 642 else
638 { 643 {
639 if (selection.op && current_screen == selection.screen) 644 if (selection.op && current_screen == selection.screen)
640 { 645 {
641 int i = selection.beg.row; 646 if ((selection.beg.row < row1 && selection.end.row > row1)
642 int j = selection.end.row; 647 || (selection.beg.row < row2 && selection.end.row > row2)
643
644 if ((i < row1 && j > row1)
645 || (i < row2 && j > row2)
646 || (i - count < row1 && i >= row1) 648 || (selection.beg.row - count < row1 && selection.beg.row >= row1)
647 || (i - count > row2 && i <= row2) 649 || (selection.beg.row - count > row2 && selection.beg.row <= row2)
648 || (j - count < row1 && j >= row1) 650 || (selection.end.row - count < row1 && selection.end.row >= row1)
649 || (j - count > row2 && j <= row2)) 651 || (selection.end.row - count > row2 && selection.end.row <= row2))
650 { 652 {
651 CLEAR_ALL_SELECTION (); 653 CLEAR_ALL_SELECTION ();
652 selection.op = SELECTION_CLEAR; /* XXX: too aggressive? */ 654 selection.op = SELECTION_CLEAR;
653 } 655 }
654 else if (j >= row1 && j <= row2) 656 else if (selection.end.row >= row1 && selection.end.row <= row2)
655 { 657 {
656 /* move selected region too */ 658 /* move selected region too */
657 selection.beg.row -= count; 659 selection.beg.row -= count;
658 selection.end.row -= count; 660 selection.end.row -= count;
659 selection.mark.row -= count; 661 selection.mark.row -= count;
694 if (len <= 0) /* sanity */ 696 if (len <= 0) /* sanity */
695 return; 697 return;
696 698
697 unsigned char checksel; 699 unsigned char checksel;
698 unicode_t c; 700 unicode_t c;
699 int row, last_col; 701 int last_col;
700 const unicode_t *strend = str + len; 702 const unicode_t *strend = str + len;
701 703
702 want_refresh = 1; 704 want_refresh = 1;
703 ZERO_SCROLLBACK (); 705 ZERO_SCROLLBACK ();
704 last_col = ncol; 706 last_col = ncol;
719#ifdef DEBUG_STRICT 721#ifdef DEBUG_STRICT
720 assert (screen.cur.col < last_col); 722 assert (screen.cur.col < last_col);
721 assert (screen.cur.row < nrow 723 assert (screen.cur.row < nrow
722 && screen.cur.row >= -nsaved); 724 && screen.cur.row >= -nsaved);
723#endif 725#endif
724 row = screen.cur.row; 726 int row = screen.cur.row;
725 727
726 checksel = selection.op && current_screen == selection.screen ? 1 : 0; 728 checksel = selection.op && current_screen == selection.screen ? 1 : 0;
727 729
728 line_t *line = &ROW(row); 730 line_t *line = &ROW(row);
729 731
986 988
987 if (count == 0) 989 if (count == 0)
988 return; 990 return;
989 else if (count > 0) 991 else if (count > 0)
990 { 992 {
991 int row = screen.cur.row;
992
993 line_t &l = ROW(row); 993 line_t &l = ROW(screen.cur.row);
994 rend_t base_rend = l.r[i]; 994 rend_t base_rend = l.r[i];
995 ht &= l.t[i] == ' '; 995 ht &= l.t[i] == ' ';
996 996
997 for (; ++i < ncol; ) 997 for (; ++i < ncol; )
998 if (tabs[i]) 998 if (tabs[i])
1073 */ 1073 */
1074#if ENABLE_FRILLS 1074#if ENABLE_FRILLS
1075void 1075void
1076rxvt_term::scr_forwardindex () 1076rxvt_term::scr_forwardindex ()
1077{ 1077{
1078 int row;
1079
1080 if (screen.cur.col < ncol - 1) 1078 if (screen.cur.col < ncol - 1)
1081 scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); 1079 scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE);
1082 else 1080 else
1083 { 1081 {
1084 row = screen.cur.row;
1085
1086 if (ROW(row).is_longer ()) //TODO//FIXME//LEN 1082 if (ROW(screen.cur.row).is_longer ()) //TODO//FIXME//LEN
1087 ROW(row).l = ncol; 1083 ROW(screen.cur.row).l = ncol;
1088 1084
1089 scr_gotorc (0, 0, R_RELATIVE); 1085 scr_gotorc (0, 0, R_RELATIVE);
1090 scr_insdel_chars (1, DELETE); 1086 scr_insdel_chars (1, DELETE);
1091 scr_gotorc (0, ncol - 1, R_RELATIVE); 1087 scr_gotorc (0, ncol - 1, R_RELATIVE);
1092 } 1088 }
1175 * XTERM_SEQ: Clear whole line : ESC [ 2 K 1171 * XTERM_SEQ: Clear whole line : ESC [ 2 K
1176 */ 1172 */
1177void 1173void
1178rxvt_term::scr_erase_line (int mode) 1174rxvt_term::scr_erase_line (int mode)
1179{ 1175{
1180 unsigned int row, col, num; 1176 unsigned int col, num;
1181 1177
1182 want_refresh = 1; 1178 want_refresh = 1;
1183 ZERO_SCROLLBACK (); 1179 ZERO_SCROLLBACK ();
1184 1180
1185 selection_check (1); 1181 selection_check (1);
1186 1182
1187 row = screen.cur.row; 1183 line_t &line = ROW(screen.cur.row);
1188 1184
1189 switch (mode) 1185 switch (mode)
1190 { 1186 {
1191 case 0: /* erase to end of line */ 1187 case 0: /* erase to end of line */
1192 col = screen.cur.col; 1188 col = screen.cur.col;
1193 num = ncol - col; 1189 num = ncol - col;
1194 min_it (ROW(row).l, col); 1190 min_it (line.l, col);
1195 if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) 1191 if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)
1196 || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) 1192 || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur))
1197 CLEAR_SELECTION (); 1193 CLEAR_SELECTION ();
1198 break; 1194 break;
1199 case 1: /* erase to beginning of line */ 1195 case 1: /* erase to beginning of line */
1204 CLEAR_SELECTION (); 1200 CLEAR_SELECTION ();
1205 break; 1201 break;
1206 case 2: /* erase whole line */ 1202 case 2: /* erase whole line */
1207 col = 0; 1203 col = 0;
1208 num = ncol; 1204 num = ncol;
1209 ROW(row).l = 0; 1205 line.l = 0;
1210 if (selection.beg.row <= screen.cur.row 1206 if (selection.beg.row <= screen.cur.row
1211 && selection.end.row >= screen.cur.row) 1207 && selection.end.row >= screen.cur.row)
1212 CLEAR_SELECTION (); 1208 CLEAR_SELECTION ();
1213 break; 1209 break;
1214 default: 1210 default:
1215 return; 1211 return;
1216 } 1212 }
1217 1213
1218 scr_blank_line (ROW(row), col, num, rstyle); 1214 scr_blank_line (line, col, num, rstyle);
1219} 1215}
1220 1216
1221/* ------------------------------------------------------------------------- */ 1217/* ------------------------------------------------------------------------- */
1222/* 1218/*
1223 * Erase part of whole of the screen 1219 * Erase part of whole of the screen

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines