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.195 by root, Mon Dec 26 23:02:34 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
352 qcol += len; 352 qcol += len;
353 } 353 }
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 printf ("qline->l %d = llen %d < ncol %d ? %d : MOD %d\n", qline->l,llen,ncol,llen,MOD (llen - 1, ncol) + 1);//D
357 scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE); 358 scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE);
358 } 359 }
360 while (p != pend && q > 0);
359 361
360 term_start = total_rows - nrow; 362 term_start = total_rows - nrow;
361 view_start = 0;
362 nsaved = term_start - q; 363 nsaved = term_start - q;
363 364
364 // make sure all terminal lines exist 365 // make sure all terminal lines exist
365 while (nsaved < 0) 366 while (nsaved < 0)
366 scr_blank_screen_mem (ROW (-++nsaved), DEFAULT_RSTYLE); 367 scr_blank_screen_mem (ROW (-++nsaved), DEFAULT_RSTYLE);
383 { 384 {
384 row_buf [row].clear (); scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE); 385 row_buf [row].clear (); scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE);
385 } 386 }
386 387
387 term_start = 0; 388 term_start = 0;
388 view_start = 0;
389 } 389 }
390 390
391#ifdef DEBUG_STRICT 391#ifdef DEBUG_STRICT //TODO: remove
392 for (int i = -nsaved; i < nrow; i++) 392 for (int i = -nsaved; i < nrow; i++)
393 assert (ROW (i).t); 393 assert (ROW (i).t);
394#endif 394#endif
395 395
396 free (old_buf); 396 free (old_buf);
621 { 621 {
622 selection.beg.row -= count; 622 selection.beg.row -= count;
623 selection.end.row -= count; 623 selection.end.row -= count;
624 selection.mark.row -= count; 624 selection.mark.row -= count;
625 625
626 selection_check (0); 626 if (selection.beg.row < -nsaved
627 || selection.end.row < -nsaved
628 || selection.mark.row < -nsaved)
629 {
630 CLEAR_ALL_SELECTION ();
631 selection.op = SELECTION_CLEAR;
632 }
627 } 633 }
628 634
629 for (int i = count; i--; ) 635 for (int i = count; i--; )
636 {
637 ROW(row2 - i).l = 0;
630 scr_blank_screen_mem (ROW(row2 - i), rstyle); 638 scr_blank_screen_mem (ROW(row2 - i), rstyle);
639 }
631 640
632 if ((options & Opt_scrollWithBuffer) 641 if ((options & Opt_scrollWithBuffer)
633 && view_start != 0 642 && view_start != 0
634 && view_start != saveLines) 643 && view_start != saveLines)
635 scr_page (UP, count); 644 scr_page (UP, count);
636 } 645 }
637 else 646 else
638 { 647 {
639 if (selection.op && current_screen == selection.screen) 648 if (selection.op && current_screen == selection.screen)
640 { 649 {
641 int i = selection.beg.row; 650 if ((selection.beg.row < row1 && selection.end.row > row1)
642 int j = selection.end.row; 651 || (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) 652 || (selection.beg.row - count < row1 && selection.beg.row >= row1)
647 || (i - count > row2 && i <= row2) 653 || (selection.beg.row - count > row2 && selection.beg.row <= row2)
648 || (j - count < row1 && j >= row1) 654 || (selection.end.row - count < row1 && selection.end.row >= row1)
649 || (j - count > row2 && j <= row2)) 655 || (selection.end.row - count > row2 && selection.end.row <= row2))
650 { 656 {
651 CLEAR_ALL_SELECTION (); 657 CLEAR_ALL_SELECTION ();
652 selection.op = SELECTION_CLEAR; /* XXX: too aggressive? */ 658 selection.op = SELECTION_CLEAR;
653 } 659 }
654 else if (j >= row1 && j <= row2) 660 else if (selection.end.row >= row1 && selection.end.row <= row2)
655 { 661 {
656 /* move selected region too */ 662 /* move selected region too */
657 selection.beg.row -= count; 663 selection.beg.row -= count;
658 selection.end.row -= count; 664 selection.end.row -= count;
659 selection.mark.row -= count; 665 selection.mark.row -= count;
694 if (len <= 0) /* sanity */ 700 if (len <= 0) /* sanity */
695 return; 701 return;
696 702
697 unsigned char checksel; 703 unsigned char checksel;
698 unicode_t c; 704 unicode_t c;
699 int row, last_col; 705 int last_col;
700 const unicode_t *strend = str + len; 706 const unicode_t *strend = str + len;
701 707
702 want_refresh = 1; 708 want_refresh = 1;
703 ZERO_SCROLLBACK (); 709 ZERO_SCROLLBACK ();
704 last_col = ncol; 710 last_col = ncol;
719#ifdef DEBUG_STRICT 725#ifdef DEBUG_STRICT
720 assert (screen.cur.col < last_col); 726 assert (screen.cur.col < last_col);
721 assert (screen.cur.row < nrow 727 assert (screen.cur.row < nrow
722 && screen.cur.row >= -nsaved); 728 && screen.cur.row >= -nsaved);
723#endif 729#endif
724 row = screen.cur.row; 730 int row = screen.cur.row;
725 731
726 checksel = selection.op && current_screen == selection.screen ? 1 : 0; 732 checksel = selection.op && current_screen == selection.screen ? 1 : 0;
727 733
728 line_t *line = &ROW(row); 734 line_t *line = &ROW(row);
729 735
731 { 737 {
732 c = *str++; 738 c = *str++;
733 739
734 if (c < 0x20) 740 if (c < 0x20)
735 if (c == C0_LF) 741 if (c == C0_LF)
736 { 742 {
737 if (!line->is_longer ()) /* XXX: think about this */ 743 if (!line->is_longer ()) /* XXX: think about this */
738 max_it (line->l, screen.cur.col); 744 max_it (line->l, screen.cur.col);
739 745
740 screen.flags &= ~Screen_WrapNext; 746 screen.flags &= ~Screen_WrapNext;
741 747
986 992
987 if (count == 0) 993 if (count == 0)
988 return; 994 return;
989 else if (count > 0) 995 else if (count > 0)
990 { 996 {
991 int row = screen.cur.row;
992
993 line_t &l = ROW(row); 997 line_t &l = ROW(screen.cur.row);
994 rend_t base_rend = l.r[i]; 998 rend_t base_rend = l.r[i];
995 ht &= l.t[i] == ' '; 999 ht &= l.t[i] == ' ';
996 1000
997 for (; ++i < ncol; ) 1001 for (; ++i < ncol; )
998 if (tabs[i]) 1002 if (tabs[i])
1073 */ 1077 */
1074#if ENABLE_FRILLS 1078#if ENABLE_FRILLS
1075void 1079void
1076rxvt_term::scr_forwardindex () 1080rxvt_term::scr_forwardindex ()
1077{ 1081{
1078 int row;
1079
1080 if (screen.cur.col < ncol - 1) 1082 if (screen.cur.col < ncol - 1)
1081 scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); 1083 scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE);
1082 else 1084 else
1083 { 1085 {
1084 row = screen.cur.row;
1085
1086 if (ROW(row).is_longer ()) //TODO//FIXME//LEN 1086 if (ROW(screen.cur.row).is_longer ()) //TODO//FIXME//LEN
1087 ROW(row).l = ncol; 1087 ROW(screen.cur.row).l = ncol;
1088 1088
1089 scr_gotorc (0, 0, R_RELATIVE); 1089 scr_gotorc (0, 0, R_RELATIVE);
1090 scr_insdel_chars (1, DELETE); 1090 scr_insdel_chars (1, DELETE);
1091 scr_gotorc (0, ncol - 1, R_RELATIVE); 1091 scr_gotorc (0, ncol - 1, R_RELATIVE);
1092 } 1092 }
1175 * XTERM_SEQ: Clear whole line : ESC [ 2 K 1175 * XTERM_SEQ: Clear whole line : ESC [ 2 K
1176 */ 1176 */
1177void 1177void
1178rxvt_term::scr_erase_line (int mode) 1178rxvt_term::scr_erase_line (int mode)
1179{ 1179{
1180 unsigned int row, col, num; 1180 unsigned int col, num;
1181 1181
1182 want_refresh = 1; 1182 want_refresh = 1;
1183 ZERO_SCROLLBACK (); 1183 ZERO_SCROLLBACK ();
1184 1184
1185 selection_check (1); 1185 selection_check (1);
1186 1186
1187 row = screen.cur.row; 1187 line_t &line = ROW(screen.cur.row);
1188 1188
1189 switch (mode) 1189 switch (mode)
1190 { 1190 {
1191 case 0: /* erase to end of line */ 1191 case 0: /* erase to end of line */
1192 col = screen.cur.col; 1192 col = screen.cur.col;
1193 num = ncol - col; 1193 num = ncol - col;
1194 min_it (ROW(row).l, col); 1194 min_it (line.l, col);
1195 if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) 1195 if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)
1196 || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) 1196 || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur))
1197 CLEAR_SELECTION (); 1197 CLEAR_SELECTION ();
1198 break; 1198 break;
1199 case 1: /* erase to beginning of line */ 1199 case 1: /* erase to beginning of line */
1204 CLEAR_SELECTION (); 1204 CLEAR_SELECTION ();
1205 break; 1205 break;
1206 case 2: /* erase whole line */ 1206 case 2: /* erase whole line */
1207 col = 0; 1207 col = 0;
1208 num = ncol; 1208 num = ncol;
1209 ROW(row).l = 0; 1209 line.l = 0;
1210 if (selection.beg.row <= screen.cur.row 1210 if (selection.beg.row <= screen.cur.row
1211 && selection.end.row >= screen.cur.row) 1211 && selection.end.row >= screen.cur.row)
1212 CLEAR_SELECTION (); 1212 CLEAR_SELECTION ();
1213 break; 1213 break;
1214 default: 1214 default:
1215 return; 1215 return;
1216 } 1216 }
1217 1217
1218 scr_blank_line (ROW(row), col, num, rstyle); 1218 scr_blank_line (line, col, num, rstyle);
1219} 1219}
1220 1220
1221/* ------------------------------------------------------------------------- */ 1221/* ------------------------------------------------------------------------- */
1222/* 1222/*
1223 * Erase part of whole of the screen 1223 * Erase part of whole of the screen
1287 XChangeGC (display->display, gc, GCForeground, &gcvalue); 1287 XChangeGC (display->display, gc, GCForeground, &gcvalue);
1288 } 1288 }
1289 1289
1290 for (; num--; row++) 1290 for (; num--; row++)
1291 { 1291 {
1292 ROW (row).l = 0;
1292 scr_blank_screen_mem (ROW (row), rstyle); 1293 scr_blank_screen_mem (ROW (row), rstyle);
1293 ROW (row).l = 0;
1294 scr_blank_line (drawn_buf [row], 0, ncol, ren); 1294 scr_blank_line (drawn_buf [row], 0, ncol, ren);
1295 } 1295 }
1296} 1296}
1297 1297
1298#if ENABLE_FRILLS 1298#if ENABLE_FRILLS
2456 row = selection.beg.row; 2456 row = selection.beg.row;
2457 } 2457 }
2458 else 2458 else
2459 { 2459 {
2460 col = 0; 2460 col = 0;
2461 row = view_start; 2461 row = -view_start;
2462 } 2462 }
2463 2463
2464 for (; row < min (selection.end.row, view_end); row++, col = 0) 2464 for (; row < min (selection.end.row, view_end); row++, col = 0)
2465 for (rend_t *srp = ROW(row).r; col < ncol; col++) 2465 for (rend_t *srp = ROW(row).r; col < ncol; col++)
2466 srp[col] ^= RS_RVid; 2466 srp[col] ^= RS_RVid;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines