1 | /*--------------------------------*-C-*--------------------------------------* |
1 | /*--------------------------------*-C-*--------------------------------------* |
2 | * File: screen.c |
2 | * File: screen.c |
3 | *---------------------------------------------------------------------------* |
3 | *---------------------------------------------------------------------------* |
4 | * $Id: screen.C,v 1.5 2003/11/27 16:49:45 pcg Exp $ |
4 | * $Id: screen.C,v 1.6 2003/12/02 21:49:46 pcg Exp $ |
5 | * |
5 | * |
6 | * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> |
6 | * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> |
7 | * |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify |
8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
… | |
… | |
37 | { |
37 | { |
38 | while (len--) |
38 | while (len--) |
39 | *start++ = value; |
39 | *start++ = value; |
40 | } |
40 | } |
41 | |
41 | |
42 | #define RESET_CHSTAT(H) \ |
|
|
43 | if ((H)->chstat == WBYTE) \ |
|
|
44 | (H)->chstat = SBYTE, (H)->lost_multi = 1 |
|
|
45 | |
|
|
46 | /* ------------------------------------------------------------------------- */ |
42 | /* ------------------------------------------------------------------------- */ |
47 | #define PROP_SIZE 16384 |
43 | #define PROP_SIZE 16384 |
48 | #define TABSIZE 8 /* default tab size */ |
44 | #define TABSIZE 8 /* default tab size */ |
49 | |
45 | |
50 | /* ------------------------------------------------------------------------- * |
46 | /* ------------------------------------------------------------------------- * |
… | |
… | |
164 | rend_t setrstyle; |
160 | rend_t setrstyle; |
165 | |
161 | |
166 | D_SCREEN((stderr, "rxvt_scr_reset()")); |
162 | D_SCREEN((stderr, "rxvt_scr_reset()")); |
167 | |
163 | |
168 | R->TermWin.view_start = 0; |
164 | R->TermWin.view_start = 0; |
169 | RESET_CHSTAT(R); |
|
|
170 | R->num_scr = 0; |
165 | R->num_scr = 0; |
171 | |
166 | |
172 | prev_ncol = R->prev_ncol; |
167 | prev_ncol = R->prev_ncol; |
173 | prev_nrow = R->prev_nrow; |
168 | prev_nrow = R->prev_nrow; |
174 | if (R->TermWin.ncol == 0) |
169 | if (R->TermWin.ncol == 0) |
… | |
… | |
363 | R->tabs[p] = (p % TABSIZE == 0) ? 1 : 0; |
358 | R->tabs[p] = (p % TABSIZE == 0) ? 1 : 0; |
364 | |
359 | |
365 | R->prev_nrow = nrow; |
360 | R->prev_nrow = nrow; |
366 | R->prev_ncol = ncol; |
361 | R->prev_ncol = ncol; |
367 | |
362 | |
368 | rxvt_tt_winsize (R->cmd_fd, R->TermWin.ncol, R->TermWin.nrow, R->cmd_pid); |
363 | R->tt_winch (); |
369 | } |
364 | } |
370 | |
365 | |
371 | /* INTPROTO */ |
366 | /* INTPROTO */ |
372 | void |
367 | void |
373 | rxvt_scr_reset_realloc(pR) |
368 | rxvt_scr_reset_realloc(pR) |
… | |
… | |
532 | R->want_refresh = 1; |
527 | R->want_refresh = 1; |
533 | |
528 | |
534 | D_SCREEN((stderr, "rxvt_scr_change_screen(%d)", scrn)); |
529 | D_SCREEN((stderr, "rxvt_scr_change_screen(%d)", scrn)); |
535 | |
530 | |
536 | R->TermWin.view_start = 0; |
531 | R->TermWin.view_start = 0; |
537 | RESET_CHSTAT(R); |
|
|
538 | |
532 | |
539 | if (R->current_screen == scrn) |
533 | if (R->current_screen == scrn) |
540 | return R->current_screen; |
534 | return R->current_screen; |
541 | |
535 | |
542 | rxvt_selection_check(aR_ 2); /* check for boundary cross */ |
536 | rxvt_selection_check(aR_ 2); /* check for boundary cross */ |
… | |
… | |
797 | rxvt_scroll_text(aR_ R->screen.tscroll, R->screen.bscroll, 1, 0); |
791 | rxvt_scroll_text(aR_ R->screen.tscroll, R->screen.bscroll, 1, 0); |
798 | else if (R->screen.cur.row < (R->TermWin.nrow - 1)) |
792 | else if (R->screen.cur.row < (R->TermWin.nrow - 1)) |
799 | row = (++R->screen.cur.row) + R->TermWin.saveLines; |
793 | row = (++R->screen.cur.row) + R->TermWin.saveLines; |
800 | stp = R->screen.text[row]; /* _must_ refresh */ |
794 | stp = R->screen.text[row]; /* _must_ refresh */ |
801 | srp = R->screen.rend[row]; /* _must_ refresh */ |
795 | srp = R->screen.rend[row]; /* _must_ refresh */ |
802 | RESET_CHSTAT(R); |
|
|
803 | continue; |
796 | continue; |
804 | case '\r': |
797 | case '\r': |
805 | if (R->screen.tlen[row] != -1) /* XXX: think about this */ |
798 | if (R->screen.tlen[row] != -1) /* XXX: think about this */ |
806 | MAX_IT(R->screen.tlen[row], R->screen.cur.col); |
799 | MAX_IT(R->screen.tlen[row], R->screen.cur.col); |
807 | R->screen.flags &= ~Screen_WrapNext; |
800 | R->screen.flags &= ~Screen_WrapNext; |
808 | R->screen.cur.col = 0; |
801 | R->screen.cur.col = 0; |
809 | RESET_CHSTAT(R); |
|
|
810 | continue; |
802 | continue; |
811 | default: |
803 | default: |
812 | if (c == 127) |
804 | if (c == 127) |
813 | continue; /* yummmm..... */ |
805 | continue; /* yummmm..... */ |
814 | break; |
806 | break; |
… | |
… | |
907 | */ |
899 | */ |
908 | /* EXTPROTO */ |
900 | /* EXTPROTO */ |
909 | void |
901 | void |
910 | rxvt_scr_backspace(pR) |
902 | rxvt_scr_backspace(pR) |
911 | { |
903 | { |
912 | RESET_CHSTAT(R); |
|
|
913 | R->want_refresh = 1; |
904 | R->want_refresh = 1; |
914 | if (R->screen.cur.col == 0) { |
905 | if (R->screen.cur.col == 0) { |
915 | if (R->screen.cur.row > 0) { |
906 | if (R->screen.cur.row > 0) { |
916 | #ifdef TERMCAP_HAS_BW |
907 | #ifdef TERMCAP_HAS_BW |
917 | R->screen.cur.col = R->TermWin.ncol - 1; |
908 | R->screen.cur.col = R->TermWin.ncol - 1; |
… | |
… | |
936 | { |
927 | { |
937 | int i, x; |
928 | int i, x; |
938 | |
929 | |
939 | D_SCREEN((stderr, "rxvt_scr_tab(%d)", count)); |
930 | D_SCREEN((stderr, "rxvt_scr_tab(%d)", count)); |
940 | R->want_refresh = 1; |
931 | R->want_refresh = 1; |
941 | RESET_CHSTAT(R); |
|
|
942 | i = x = R->screen.cur.col; |
932 | i = x = R->screen.cur.col; |
943 | if (count == 0) |
933 | if (count == 0) |
944 | return; |
934 | return; |
945 | else if (count > 0) { |
935 | else if (count > 0) { |
946 | for (; ++i < R->TermWin.ncol; ) |
936 | for (; ++i < R->TermWin.ncol; ) |
… | |
… | |
1023 | void |
1013 | void |
1024 | rxvt_scr_gotorc(pR_ int row, int col, int relative) |
1014 | rxvt_scr_gotorc(pR_ int row, int col, int relative) |
1025 | { |
1015 | { |
1026 | R->want_refresh = 1; |
1016 | R->want_refresh = 1; |
1027 | ZERO_SCROLLBACK(R); |
1017 | ZERO_SCROLLBACK(R); |
1028 | RESET_CHSTAT(R); |
|
|
1029 | #ifdef RXVT_GRAPHICS |
1018 | #ifdef RXVT_GRAPHICS |
1030 | if (rxvt_Gr_Displayed(aR)) |
1019 | if (rxvt_Gr_Displayed(aR)) |
1031 | rxvt_Gr_scroll(aR_ 0); |
1020 | rxvt_Gr_scroll(aR_ 0); |
1032 | #endif |
1021 | #endif |
1033 | |
1022 | |
… | |
… | |
1077 | R->want_refresh = 1; |
1066 | R->want_refresh = 1; |
1078 | dirn = ((direction == UP) ? 1 : -1); |
1067 | dirn = ((direction == UP) ? 1 : -1); |
1079 | D_SCREEN((stderr, "rxvt_scr_index(%d)", dirn)); |
1068 | D_SCREEN((stderr, "rxvt_scr_index(%d)", dirn)); |
1080 | |
1069 | |
1081 | ZERO_SCROLLBACK(R); |
1070 | ZERO_SCROLLBACK(R); |
1082 | RESET_CHSTAT(R); |
|
|
1083 | |
1071 | |
1084 | #ifdef RXVT_GRAPHICS |
1072 | #ifdef RXVT_GRAPHICS |
1085 | if (rxvt_Gr_Displayed(aR)) |
1073 | if (rxvt_Gr_Displayed(aR)) |
1086 | rxvt_Gr_scroll(aR_ 0); |
1074 | rxvt_Gr_scroll(aR_ 0); |
1087 | #endif |
1075 | #endif |
… | |
… | |
1111 | unsigned int row, col, num; |
1099 | unsigned int row, col, num; |
1112 | |
1100 | |
1113 | R->want_refresh = 1; |
1101 | R->want_refresh = 1; |
1114 | D_SCREEN((stderr, "rxvt_scr_erase_line(%d) at screen row: %d", mode, R->screen.cur.row)); |
1102 | D_SCREEN((stderr, "rxvt_scr_erase_line(%d) at screen row: %d", mode, R->screen.cur.row)); |
1115 | ZERO_SCROLLBACK(R); |
1103 | ZERO_SCROLLBACK(R); |
1116 | RESET_CHSTAT(R); |
|
|
1117 | |
1104 | |
1118 | #ifdef RXVT_GRAPHICS |
1105 | #ifdef RXVT_GRAPHICS |
1119 | if (rxvt_Gr_Displayed(aR)) |
1106 | if (rxvt_Gr_Displayed(aR)) |
1120 | rxvt_Gr_scroll(aR_ 0); |
1107 | rxvt_Gr_scroll(aR_ 0); |
1121 | #endif |
1108 | #endif |
… | |
… | |
1178 | XGCValues gcvalue; |
1165 | XGCValues gcvalue; |
1179 | |
1166 | |
1180 | R->want_refresh = 1; |
1167 | R->want_refresh = 1; |
1181 | D_SCREEN((stderr, "rxvt_scr_erase_screen(%d) at screen row: %d", mode, R->screen.cur.row)); |
1168 | D_SCREEN((stderr, "rxvt_scr_erase_screen(%d) at screen row: %d", mode, R->screen.cur.row)); |
1182 | ZERO_SCROLLBACK(R); |
1169 | ZERO_SCROLLBACK(R); |
1183 | RESET_CHSTAT(R); |
|
|
1184 | row_offset = (int32_t)R->TermWin.saveLines; |
1170 | row_offset = (int32_t)R->TermWin.saveLines; |
1185 | |
1171 | |
1186 | switch (mode) { |
1172 | switch (mode) { |
1187 | case 0: /* erase to end of screen */ |
1173 | case 0: /* erase to end of screen */ |
1188 | rxvt_selection_check(aR_ 1); |
1174 | rxvt_selection_check(aR_ 1); |
… | |
… | |
1252 | rend_t *r1, fs; |
1238 | rend_t *r1, fs; |
1253 | |
1239 | |
1254 | R->want_refresh = 1; |
1240 | R->want_refresh = 1; |
1255 | R->num_scr_allow = 0; |
1241 | R->num_scr_allow = 0; |
1256 | ZERO_SCROLLBACK(R); |
1242 | ZERO_SCROLLBACK(R); |
1257 | RESET_CHSTAT(R); |
|
|
1258 | rxvt_selection_check(aR_ 3); |
1243 | rxvt_selection_check(aR_ 3); |
1259 | |
1244 | |
1260 | fs = SET_FONT (R->rstyle, R->TermWin.fontset->find_font ('E')); |
1245 | fs = SET_FONT (R->rstyle, R->TermWin.fontset->find_font ('E')); |
1261 | for (k = R->TermWin.saveLines, i = R->TermWin.nrow; i--; k++) { |
1246 | for (k = R->TermWin.saveLines, i = R->TermWin.nrow; i--; k++) { |
1262 | R->screen.tlen[k] = R->TermWin.ncol; /* make the `E's selectable */ |
1247 | R->screen.tlen[k] = R->TermWin.ncol; /* make the `E's selectable */ |
… | |
… | |
1275 | rxvt_scr_insdel_lines(pR_ int count, int insdel) |
1260 | rxvt_scr_insdel_lines(pR_ int count, int insdel) |
1276 | { |
1261 | { |
1277 | int end; |
1262 | int end; |
1278 | |
1263 | |
1279 | ZERO_SCROLLBACK(R); |
1264 | ZERO_SCROLLBACK(R); |
1280 | RESET_CHSTAT(R); |
|
|
1281 | |
1265 | |
1282 | #ifdef RXVT_GRAPHICS |
1266 | #ifdef RXVT_GRAPHICS |
1283 | if (rxvt_Gr_Displayed(aR)) |
1267 | if (rxvt_Gr_Displayed(aR)) |
1284 | rxvt_Gr_scroll(aR_ 0); |
1268 | rxvt_Gr_scroll(aR_ 0); |
1285 | #endif |
1269 | #endif |
… | |
… | |
1316 | rend_t *srp; |
1300 | rend_t *srp; |
1317 | int16_t *slp; |
1301 | int16_t *slp; |
1318 | |
1302 | |
1319 | R->want_refresh = 1; |
1303 | R->want_refresh = 1; |
1320 | ZERO_SCROLLBACK(R); |
1304 | ZERO_SCROLLBACK(R); |
1321 | #if 0 |
|
|
1322 | RESET_CHSTAT(R); |
|
|
1323 | #endif |
|
|
1324 | |
1305 | |
1325 | #ifdef RXVT_GRAPHICS |
1306 | #ifdef RXVT_GRAPHICS |
1326 | if (rxvt_Gr_Displayed(aR)) |
1307 | if (rxvt_Gr_Displayed(aR)) |
1327 | rxvt_Gr_scroll(aR_ 0); |
1308 | rxvt_Gr_scroll(aR_ 0); |
1328 | #endif |
1309 | #endif |