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.66 by pcg, Sun Mar 28 02:07:08 2004 UTC vs.
Revision 1.71 by pcg, Thu Apr 8 20:31:45 2004 UTC

1/*--------------------------------*-C-*--------------------------------------* 1/*--------------------------------*-C-*--------------------------------------*
2 * File: screen.c 2 * File: screen.C
3 *---------------------------------------------------------------------------* 3 *---------------------------------------------------------------------------*
4 * 4 *
5 * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> 5 * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com>
6 * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com> 6 * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com>
7 * 7 *
511 s->s_cur.col = s->cur.col; 511 s->s_cur.col = s->cur.col;
512 s->s_rstyle = rstyle; 512 s->s_rstyle = rstyle;
513 s->s_charset = s->charset; 513 s->s_charset = s->charset;
514 s->s_charset_char = charsets[s->charset]; 514 s->s_charset_char = charsets[s->charset];
515 break; 515 break;
516
516 case RESTORE: 517 case RESTORE:
517 want_refresh = 1; 518 want_refresh = 1;
518 s->cur.row = s->s_cur.row; 519 s->cur.row = s->s_cur.row;
519 s->cur.col = s->s_cur.col; 520 s->cur.col = s->s_cur.col;
520 s->flags &= ~Screen_WrapNext; 521 s->flags &= ~Screen_WrapNext;
556 D_SCREEN ((stderr, "rxvt_scr_change_screen (%d)", scrn)); 557 D_SCREEN ((stderr, "rxvt_scr_change_screen (%d)", scrn));
557 558
558 TermWin.view_start = 0; 559 TermWin.view_start = 0;
559 560
560 if (current_screen == scrn) 561 if (current_screen == scrn)
561 return current_screen; 562 return scrn;
562 563
563 selection_check (2); /* check for boundary cross */ 564 selection_check (2); /* check for boundary cross */
564 565
565 SWAP_IT (current_screen, scrn, int); 566 SWAP_IT (current_screen, scrn, int);
566#if NSCREENS 567#if NSCREENS
568 if (Options & Opt_secondaryScreen)
569 {
567 num_scr = 0; 570 num_scr = 0;
568 offset = TermWin.saveLines; 571 offset = TermWin.saveLines;
569 for (i = prev_nrow; i--;) 572 for (i = prev_nrow; i--;)
570 { 573 {
571 SWAP_IT (screen.text[i + offset], swap.text[i], text_t *); 574 SWAP_IT (screen.text[i + offset], swap.text[i], text_t *);
572 SWAP_IT (screen.tlen[i + offset], swap.tlen[i], int16_t); 575 SWAP_IT (screen.tlen[i + offset], swap.tlen[i], int16_t);
573 SWAP_IT (screen.rend[i + offset], swap.rend[i], rend_t *); 576 SWAP_IT (screen.rend[i + offset], swap.rend[i], rend_t *);
574 } 577 }
575 SWAP_IT (screen.cur.row, swap.cur.row, int16_t); 578 SWAP_IT (screen.cur.row, swap.cur.row, int16_t);
576 SWAP_IT (screen.cur.col, swap.cur.col, int16_t); 579 SWAP_IT (screen.cur.col, swap.cur.col, int16_t);
577# ifdef DEBUG_STRICT 580# ifdef DEBUG_STRICT
578 assert ((screen.cur.row >= 0) && (screen.cur.row < prev_nrow)); 581 assert ((screen.cur.row >= 0) && (screen.cur.row < prev_nrow));
579 assert ((screen.cur.col >= 0) && (screen.cur.col < prev_ncol)); 582 assert ((screen.cur.col >= 0) && (screen.cur.col < prev_ncol));
580# else /* drive with your eyes closed */ 583# else /* drive with your eyes closed */
581 MAX_IT (screen.cur.row, 0); 584 MAX_IT (screen.cur.row, 0);
582 MIN_IT (screen.cur.row, (int32_t)prev_nrow - 1); 585 MIN_IT (screen.cur.row, (int32_t)prev_nrow - 1);
583 MAX_IT (screen.cur.col, 0); 586 MAX_IT (screen.cur.col, 0);
584 MIN_IT (screen.cur.col, (int32_t)prev_ncol - 1); 587 MIN_IT (screen.cur.col, (int32_t)prev_ncol - 1);
585# endif 588# endif
586 SWAP_IT (screen.charset, swap.charset, int16_t); 589 SWAP_IT (screen.charset, swap.charset, int16_t);
587 SWAP_IT (screen.flags, swap.flags, int); 590 SWAP_IT (screen.flags, swap.flags, int);
588 screen.flags |= Screen_VisibleCursor; 591 screen.flags |= Screen_VisibleCursor;
589 swap.flags |= Screen_VisibleCursor; 592 swap.flags |= Screen_VisibleCursor;
590#else 593 }
591# ifdef SCROLL_ON_NO_SECONDARY 594 else
595#endif
596 if (Options & Opt_secondaryScroll)
592 if (current_screen == PRIMARY) 597 //if (current_screen == PRIMARY)
593 scr_scroll_text (0, (prev_nrow - 1), prev_nrow, 0); 598 scr_scroll_text (0, (prev_nrow - 1), prev_nrow, 0);
594# endif
595#endif
596 return scrn; 599 return scrn;
597} 600}
598 601
599/* ------------------------------------------------------------------------- */ 602/* ------------------------------------------------------------------------- */
600/* 603/*
642 return 0; 645 return 0;
643 646
644 want_refresh = 1; 647 want_refresh = 1;
645 D_SCREEN ((stderr, "rxvt_scroll_text (%d,%d,%d,%d): %s", row1, row2, count, spec, (current_screen == PRIMARY) ? "Primary" : "Secondary")); 648 D_SCREEN ((stderr, "rxvt_scroll_text (%d,%d,%d,%d): %s", row1, row2, count, spec, (current_screen == PRIMARY) ? "Primary" : "Secondary"));
646 649
647 if ((count > 0) && (row1 == 0) && (current_screen == PRIMARY)) 650 if (row1 == 0 && count > 0
651 && (current_screen == PRIMARY || Options & Opt_secondaryScroll))
648 { 652 {
649 nscrolled = (long)TermWin.nscrolled + (long)count; 653 nscrolled = (long)TermWin.nscrolled + (long)count;
650 654
651 if (nscrolled > (long)TermWin.saveLines) 655 if (nscrolled > (long)TermWin.saveLines)
652 TermWin.nscrolled = TermWin.saveLines; 656 TermWin.nscrolled = TermWin.saveLines;
807 c = *str++; 811 c = *str++;
808 812
809 if (c < 0x20) 813 if (c < 0x20)
810 switch (c) 814 switch (c)
811 { 815 {
812 case '\t': 816 case C0_HT:
813 scr_tab (1); 817 scr_tab (1);
814 continue; 818 continue;
815 819
816 case '\n': 820 case C0_LF:
817 if (screen.tlen[row] != -1) /* XXX: think about this */ 821 if (screen.tlen[row] != -1) /* XXX: think about this */
818 MAX_IT (screen.tlen[row], screen.cur.col); 822 MAX_IT (screen.tlen[row], screen.cur.col);
819 823
820 screen.flags &= ~Screen_WrapNext; 824 screen.flags &= ~Screen_WrapNext;
821 825
826 830
827 stp = screen.text[row]; /* _must_ refresh */ 831 stp = screen.text[row]; /* _must_ refresh */
828 srp = screen.rend[row]; /* _must_ refresh */ 832 srp = screen.rend[row]; /* _must_ refresh */
829 continue; 833 continue;
830 834
831 case '\r': 835 case C0_CR:
832 if (screen.tlen[row] != -1) /* XXX: think about this */ 836 if (screen.tlen[row] != -1) /* XXX: think about this */
833 MAX_IT (screen.tlen[row], screen.cur.col); 837 MAX_IT (screen.tlen[row], screen.cur.col);
834 838
835 screen.flags &= ~Screen_WrapNext; 839 screen.flags &= ~Screen_WrapNext;
836 screen.cur.col = 0; 840 screen.cur.col = 0;
984 */ 988 */
985void 989void
986rxvt_term::scr_backspace () 990rxvt_term::scr_backspace ()
987{ 991{
988 want_refresh = 1; 992 want_refresh = 1;
993
989 if (screen.cur.col == 0) 994 if (screen.cur.col == 0)
990 { 995 {
991 if (screen.cur.row > 0) 996 if (screen.cur.row > 0)
992 { 997 {
993#ifdef TERMCAP_HAS_BW 998#ifdef TERMCAP_HAS_BW
998 1003
999 } 1004 }
1000 } 1005 }
1001 else if ((screen.flags & Screen_WrapNext) == 0) 1006 else if ((screen.flags & Screen_WrapNext) == 0)
1002 scr_gotorc (0, -1, RELATIVE); 1007 scr_gotorc (0, -1, RELATIVE);
1008
1003 screen.flags &= ~Screen_WrapNext; 1009 screen.flags &= ~Screen_WrapNext;
1004} 1010}
1005 1011
1006/* ------------------------------------------------------------------------- */ 1012/* ------------------------------------------------------------------------- */
1007/* 1013/*
1111 want_refresh = 1; 1117 want_refresh = 1;
1112 ZERO_SCROLLBACK (); 1118 ZERO_SCROLLBACK ();
1113 1119
1114 D_SCREEN ((stderr, "rxvt_scr_gotorc (r:%s%d,c:%s%d): from (r:%d,c:%d)", (relative & R_RELATIVE ? "+" : ""), row, (relative & C_RELATIVE ? "+" : ""), col, screen.cur.row, screen.cur.col)); 1120 D_SCREEN ((stderr, "rxvt_scr_gotorc (r:%s%d,c:%s%d): from (r:%d,c:%d)", (relative & R_RELATIVE ? "+" : ""), row, (relative & C_RELATIVE ? "+" : ""), col, screen.cur.row, screen.cur.col));
1115 1121
1116 screen.cur.col = ((relative & C_RELATIVE) ? (screen.cur.col + col) 1122 screen.cur.col = relative & C_RELATIVE ? screen.cur.col + col : col;
1117 : col);
1118 MAX_IT (screen.cur.col, 0); 1123 MAX_IT (screen.cur.col, 0);
1119 MIN_IT (screen.cur.col, (int32_t)TermWin.ncol - 1); 1124 MIN_IT (screen.cur.col, (int32_t)TermWin.ncol - 1);
1120 1125
1121 screen.flags &= ~Screen_WrapNext; 1126 screen.flags &= ~Screen_WrapNext;
1122 if (relative & R_RELATIVE) 1127 if (relative & R_RELATIVE)
1161 * direction should be UP or DN 1166 * direction should be UP or DN
1162 */ 1167 */
1163void 1168void
1164rxvt_term::scr_index (enum page_dirn direction) 1169rxvt_term::scr_index (enum page_dirn direction)
1165{ 1170{
1166 int dirn; 1171 int dirn;
1167 1172
1168 want_refresh = 1; 1173 want_refresh = 1;
1169 dirn = ((direction == UP) ? 1 : -1); 1174 dirn = ((direction == UP) ? 1 : -1);
1170 D_SCREEN ((stderr, "rxvt_scr_index (%d)", dirn)); 1175 D_SCREEN ((stderr, "rxvt_scr_index (%d)", dirn));
1171 1176
1514 */ 1519 */
1515void 1520void
1516rxvt_term::scr_cursor_visible (int mode) 1521rxvt_term::scr_cursor_visible (int mode)
1517{ 1522{
1518 want_refresh = 1; 1523 want_refresh = 1;
1524
1519 if (mode) 1525 if (mode)
1520 screen.flags |= Screen_VisibleCursor; 1526 screen.flags |= Screen_VisibleCursor;
1521 else 1527 else
1522 screen.flags &= ~Screen_VisibleCursor; 1528 screen.flags &= ~Screen_VisibleCursor;
1523} 1529}
1839 if (TermWin.view_start != oldviewstart) 1845 if (TermWin.view_start != oldviewstart)
1840 { 1846 {
1841 want_refresh = 1; 1847 want_refresh = 1;
1842 num_scr -= (TermWin.view_start - oldviewstart); 1848 num_scr -= (TermWin.view_start - oldviewstart);
1843 } 1849 }
1850
1844 return (int) (TermWin.view_start - oldviewstart); 1851 return (int) (TermWin.view_start - oldviewstart);
1845} 1852}
1846 1853
1847/* ------------------------------------------------------------------------- */ 1854/* ------------------------------------------------------------------------- */
1848void 1855void
2514 { 2521 {
2515 n = min (len - i, PROP_SIZE); 2522 n = min (len - i, PROP_SIZE);
2516 MEMCPY (ds, data + i, n); 2523 MEMCPY (ds, data + i, n);
2517 2524
2518 for (j = 0; j < n; j++) 2525 for (j = 0; j < n; j++)
2519 if (ds[j] == '\n') 2526 if (ds[j] == C0_LF)
2520 ds[j] = '\r'; 2527 ds[j] = C0_CR;
2521 2528
2522 tt_write (ds, (int)n); 2529 tt_write (ds, (int)n);
2523 } 2530 }
2524 2531
2525 free (ds); 2532 free (ds);
2876 else 2883 else
2877 new_selection_text[ofs++] = *t++; 2884 new_selection_text[ofs++] = *t++;
2878 } 2885 }
2879 2886
2880 if (screen.tlen[row] != -1 && row != end_row) 2887 if (screen.tlen[row] != -1 && row != end_row)
2881 new_selection_text[ofs++] = L'\n'; 2888 new_selection_text[ofs++] = C0_LF;
2882 } 2889 }
2883 2890
2884 if (end_col != selection.end.col) 2891 if (end_col != selection.end.col)
2885 new_selection_text[ofs++] = L'\n'; 2892 new_selection_text[ofs++] = C0_LF;
2886 2893
2887 new_selection_text[ofs] = 0; 2894 new_selection_text[ofs] = 0;
2888 2895
2889 if (ofs == 0) 2896 if (ofs == 0)
2890 { 2897 {
3117 * Extend the selection to the specified col/row 3124 * Extend the selection to the specified col/row
3118 */ 3125 */
3119void 3126void
3120rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int buttonpress, int clickchange) 3127rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int buttonpress, int clickchange)
3121{ 3128{
3122 int16_t ncol = TermWin.ncol; 3129 int16_t ncol = TermWin.ncol;
3123 int end_col; 3130 int end_col;
3124 row_col_t pos; 3131 row_col_t pos;
3125 enum { 3132 enum {
3126 LEFT, RIGHT 3133 LEFT, RIGHT
3127 } closeto = RIGHT; 3134 } closeto = RIGHT;
3128 3135
3129 D_SELECT ((stderr, "rxvt_selection_extend_colrow (c:%d, r:%d, %d, %d) clicks:%d, op:%d", col, row, button3, buttonpress, selection.clicks, selection.op)); 3136 D_SELECT ((stderr, "rxvt_selection_extend_colrow (c:%d, r:%d, %d, %d) clicks:%d, op:%d", col, row, button3, buttonpress, selection.clicks, selection.op));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines