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.197 by root, Tue Dec 27 00:52:38 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
351 lofs += len; 351 lofs += len;
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 ? MOD (llen - 1, ncol) + 1 : 0;
357#ifdef DEBUG_STRICT //TODO//FIXME//TEMPORARY
358 if (qline->l < 0)
359 {
360 fprintf (stderr, "ERROR, PLEASE REPORT to rxvt-unicode@plan9.de: qline->l %d = llen %d < ncol %d ? %d : MOD %d\n", qline->l,llen,ncol,llen,MOD (llen - 1, ncol) + 1);//D
361 qline->l = 0;
362 }
363#endif
357 scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE); 364 scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE);
358 } 365 }
366 while (p != pend && q > 0);
359 367
360 term_start = total_rows - nrow; 368 term_start = total_rows - nrow;
361 view_start = 0;
362 nsaved = term_start - q; 369 nsaved = term_start - q;
363 370
364 // make sure all terminal lines exist 371 // make sure all terminal lines exist
365 while (nsaved < 0) 372 while (nsaved < 0)
366 scr_blank_screen_mem (ROW (-++nsaved), DEFAULT_RSTYLE); 373 scr_blank_screen_mem (ROW (-++nsaved), DEFAULT_RSTYLE);
383 { 390 {
384 row_buf [row].clear (); scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE); 391 row_buf [row].clear (); scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE);
385 } 392 }
386 393
387 term_start = 0; 394 term_start = 0;
388 view_start = 0;
389 } 395 }
390 396
391#ifdef DEBUG_STRICT 397#ifdef DEBUG_STRICT //TODO: remove
392 for (int i = -nsaved; i < nrow; i++) 398 for (int i = -nsaved; i < nrow; i++)
393 assert (ROW (i).t); 399 assert (ROW (i).t);
394#endif 400#endif
395 401
396 free (old_buf); 402 free (old_buf);
621 { 627 {
622 selection.beg.row -= count; 628 selection.beg.row -= count;
623 selection.end.row -= count; 629 selection.end.row -= count;
624 selection.mark.row -= count; 630 selection.mark.row -= count;
625 631
626 selection_check (0); 632 if (selection.beg.row < -nsaved
633 || selection.end.row < -nsaved
634 || selection.mark.row < -nsaved)
635 {
636 CLEAR_ALL_SELECTION ();
637 selection.op = SELECTION_CLEAR;
638 }
627 } 639 }
628 640
629 for (int i = count; i--; ) 641 for (int i = count; i--; )
642 {
643 ROW(row2 - i).l = 0;
630 scr_blank_screen_mem (ROW(row2 - i), rstyle); 644 scr_blank_screen_mem (ROW(row2 - i), rstyle);
645 }
631 646
632 if ((options & Opt_scrollWithBuffer) 647 if ((options & Opt_scrollWithBuffer)
633 && view_start != 0 648 && view_start != 0
634 && view_start != saveLines) 649 && view_start != saveLines)
635 scr_page (UP, count); 650 scr_page (UP, count);
636 } 651 }
637 else 652 else
638 { 653 {
639 if (selection.op && current_screen == selection.screen) 654 if (selection.op && current_screen == selection.screen)
640 { 655 {
641 int i = selection.beg.row; 656 if ((selection.beg.row < row1 && selection.end.row > row1)
642 int j = selection.end.row; 657 || (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) 658 || (selection.beg.row - count < row1 && selection.beg.row >= row1)
647 || (i - count > row2 && i <= row2) 659 || (selection.beg.row - count > row2 && selection.beg.row <= row2)
648 || (j - count < row1 && j >= row1) 660 || (selection.end.row - count < row1 && selection.end.row >= row1)
649 || (j - count > row2 && j <= row2)) 661 || (selection.end.row - count > row2 && selection.end.row <= row2))
650 { 662 {
651 CLEAR_ALL_SELECTION (); 663 CLEAR_ALL_SELECTION ();
652 selection.op = SELECTION_CLEAR; /* XXX: too aggressive? */ 664 selection.op = SELECTION_CLEAR;
653 } 665 }
654 else if (j >= row1 && j <= row2) 666 else if (selection.end.row >= row1 && selection.end.row <= row2)
655 { 667 {
656 /* move selected region too */ 668 /* move selected region too */
657 selection.beg.row -= count; 669 selection.beg.row -= count;
658 selection.end.row -= count; 670 selection.end.row -= count;
659 selection.mark.row -= count; 671 selection.mark.row -= count;
694 if (len <= 0) /* sanity */ 706 if (len <= 0) /* sanity */
695 return; 707 return;
696 708
697 unsigned char checksel; 709 unsigned char checksel;
698 unicode_t c; 710 unicode_t c;
699 int row, last_col; 711 int last_col;
700 const unicode_t *strend = str + len; 712 const unicode_t *strend = str + len;
701 713
702 want_refresh = 1; 714 want_refresh = 1;
703 ZERO_SCROLLBACK (); 715 ZERO_SCROLLBACK ();
704 last_col = ncol; 716 last_col = ncol;
719#ifdef DEBUG_STRICT 731#ifdef DEBUG_STRICT
720 assert (screen.cur.col < last_col); 732 assert (screen.cur.col < last_col);
721 assert (screen.cur.row < nrow 733 assert (screen.cur.row < nrow
722 && screen.cur.row >= -nsaved); 734 && screen.cur.row >= -nsaved);
723#endif 735#endif
724 row = screen.cur.row; 736 int row = screen.cur.row;
725 737
726 checksel = selection.op && current_screen == selection.screen ? 1 : 0; 738 checksel = selection.op && current_screen == selection.screen ? 1 : 0;
727 739
728 line_t *line = &ROW(row); 740 line_t *line = &ROW(row);
729 741
731 { 743 {
732 c = *str++; 744 c = *str++;
733 745
734 if (c < 0x20) 746 if (c < 0x20)
735 if (c == C0_LF) 747 if (c == C0_LF)
736 { 748 {
737 if (!line->is_longer ()) /* XXX: think about this */ 749 if (!line->is_longer ()) /* XXX: think about this */
738 max_it (line->l, screen.cur.col); 750 max_it (line->l, screen.cur.col);
739 751
740 screen.flags &= ~Screen_WrapNext; 752 screen.flags &= ~Screen_WrapNext;
741 753
986 998
987 if (count == 0) 999 if (count == 0)
988 return; 1000 return;
989 else if (count > 0) 1001 else if (count > 0)
990 { 1002 {
991 int row = screen.cur.row;
992
993 line_t &l = ROW(row); 1003 line_t &l = ROW(screen.cur.row);
994 rend_t base_rend = l.r[i]; 1004 rend_t base_rend = l.r[i];
995 ht &= l.t[i] == ' '; 1005 ht &= l.t[i] == ' ';
996 1006
997 for (; ++i < ncol; ) 1007 for (; ++i < ncol; )
998 if (tabs[i]) 1008 if (tabs[i])
1073 */ 1083 */
1074#if ENABLE_FRILLS 1084#if ENABLE_FRILLS
1075void 1085void
1076rxvt_term::scr_forwardindex () 1086rxvt_term::scr_forwardindex ()
1077{ 1087{
1078 int row;
1079
1080 if (screen.cur.col < ncol - 1) 1088 if (screen.cur.col < ncol - 1)
1081 scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); 1089 scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE);
1082 else 1090 else
1083 { 1091 {
1084 row = screen.cur.row;
1085
1086 if (ROW(row).is_longer ()) //TODO//FIXME//LEN 1092 if (ROW(screen.cur.row).is_longer ()) //TODO//FIXME//LEN
1087 ROW(row).l = ncol; 1093 ROW(screen.cur.row).l = ncol;
1088 1094
1089 scr_gotorc (0, 0, R_RELATIVE); 1095 scr_gotorc (0, 0, R_RELATIVE);
1090 scr_insdel_chars (1, DELETE); 1096 scr_insdel_chars (1, DELETE);
1091 scr_gotorc (0, ncol - 1, R_RELATIVE); 1097 scr_gotorc (0, ncol - 1, R_RELATIVE);
1092 } 1098 }
1175 * XTERM_SEQ: Clear whole line : ESC [ 2 K 1181 * XTERM_SEQ: Clear whole line : ESC [ 2 K
1176 */ 1182 */
1177void 1183void
1178rxvt_term::scr_erase_line (int mode) 1184rxvt_term::scr_erase_line (int mode)
1179{ 1185{
1180 unsigned int row, col, num; 1186 unsigned int col, num;
1181 1187
1182 want_refresh = 1; 1188 want_refresh = 1;
1183 ZERO_SCROLLBACK (); 1189 ZERO_SCROLLBACK ();
1184 1190
1185 selection_check (1); 1191 selection_check (1);
1186 1192
1187 row = screen.cur.row; 1193 line_t &line = ROW(screen.cur.row);
1188 1194
1189 switch (mode) 1195 switch (mode)
1190 { 1196 {
1191 case 0: /* erase to end of line */ 1197 case 0: /* erase to end of line */
1192 col = screen.cur.col; 1198 col = screen.cur.col;
1193 num = ncol - col; 1199 num = ncol - col;
1194 min_it (ROW(row).l, col); 1200 min_it (line.l, col);
1195 if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) 1201 if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)
1196 || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) 1202 || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur))
1197 CLEAR_SELECTION (); 1203 CLEAR_SELECTION ();
1198 break; 1204 break;
1199 case 1: /* erase to beginning of line */ 1205 case 1: /* erase to beginning of line */
1204 CLEAR_SELECTION (); 1210 CLEAR_SELECTION ();
1205 break; 1211 break;
1206 case 2: /* erase whole line */ 1212 case 2: /* erase whole line */
1207 col = 0; 1213 col = 0;
1208 num = ncol; 1214 num = ncol;
1209 ROW(row).l = 0; 1215 line.l = 0;
1210 if (selection.beg.row <= screen.cur.row 1216 if (selection.beg.row <= screen.cur.row
1211 && selection.end.row >= screen.cur.row) 1217 && selection.end.row >= screen.cur.row)
1212 CLEAR_SELECTION (); 1218 CLEAR_SELECTION ();
1213 break; 1219 break;
1214 default: 1220 default:
1215 return; 1221 return;
1216 } 1222 }
1217 1223
1218 scr_blank_line (ROW(row), col, num, rstyle); 1224 scr_blank_line (line, col, num, rstyle);
1219} 1225}
1220 1226
1221/* ------------------------------------------------------------------------- */ 1227/* ------------------------------------------------------------------------- */
1222/* 1228/*
1223 * Erase part of whole of the screen 1229 * Erase part of whole of the screen
1287 XChangeGC (display->display, gc, GCForeground, &gcvalue); 1293 XChangeGC (display->display, gc, GCForeground, &gcvalue);
1288 } 1294 }
1289 1295
1290 for (; num--; row++) 1296 for (; num--; row++)
1291 { 1297 {
1298 ROW (row).l = 0;
1292 scr_blank_screen_mem (ROW (row), rstyle); 1299 scr_blank_screen_mem (ROW (row), rstyle);
1293 ROW (row).l = 0;
1294 scr_blank_line (drawn_buf [row], 0, ncol, ren); 1300 scr_blank_line (drawn_buf [row], 0, ncol, ren);
1295 } 1301 }
1296} 1302}
1297 1303
1298#if ENABLE_FRILLS 1304#if ENABLE_FRILLS
2184 * Determine the attributes for the string 2190 * Determine the attributes for the string
2185 */ 2191 */
2186 int fore = GET_FGCOLOR (rend); // desired foreground 2192 int fore = GET_FGCOLOR (rend); // desired foreground
2187 int back = GET_BGCOLOR (rend); // desired background 2193 int back = GET_BGCOLOR (rend); // desired background
2188 2194
2189 // only do special processing if any attributes are set, which is rare 2195 // only do special processing if any attributes are set, which is unlikely
2190 if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)) 2196 if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful))
2191 { 2197 {
2192#if ENABLE_STYLES 2198#if ENABLE_STYLES
2193 // force redraw after "careful" characters to avoid pixel droppings 2199 // force redraw after "careful" characters to avoid pixel droppings
2194 if (srp[col] & RS_Careful && col < ncol - 1 && 0) 2200 if (srp[col] & RS_Careful && col < ncol - 1 && 0)
2456 row = selection.beg.row; 2462 row = selection.beg.row;
2457 } 2463 }
2458 else 2464 else
2459 { 2465 {
2460 col = 0; 2466 col = 0;
2461 row = view_start; 2467 row = -view_start;
2462 } 2468 }
2463 2469
2464 for (; row < min (selection.end.row, view_end); row++, col = 0) 2470 for (; row < min (selection.end.row, view_end); row++, col = 0)
2465 for (rend_t *srp = ROW(row).r; col < ncol; col++) 2471 for (rend_t *srp = ROW(row).r; col < ncol; col++)
2466 srp[col] ^= RS_RVid; 2472 srp[col] ^= RS_RVid;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines