… | |
… | |
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); |
… | |
… | |
694 | if (len <= 0) /* sanity */ |
693 | if (len <= 0) /* sanity */ |
695 | return; |
694 | return; |
696 | |
695 | |
697 | unsigned char checksel; |
696 | unsigned char checksel; |
698 | unicode_t c; |
697 | unicode_t c; |
699 | int row, last_col; |
698 | int last_col; |
700 | const unicode_t *strend = str + len; |
699 | const unicode_t *strend = str + len; |
701 | |
700 | |
702 | want_refresh = 1; |
701 | want_refresh = 1; |
703 | ZERO_SCROLLBACK (); |
702 | ZERO_SCROLLBACK (); |
704 | last_col = ncol; |
703 | last_col = ncol; |
… | |
… | |
719 | #ifdef DEBUG_STRICT |
718 | #ifdef DEBUG_STRICT |
720 | assert (screen.cur.col < last_col); |
719 | assert (screen.cur.col < last_col); |
721 | assert (screen.cur.row < nrow |
720 | assert (screen.cur.row < nrow |
722 | && screen.cur.row >= -nsaved); |
721 | && screen.cur.row >= -nsaved); |
723 | #endif |
722 | #endif |
724 | row = screen.cur.row; |
723 | int row = screen.cur.row; |
725 | |
724 | |
726 | checksel = selection.op && current_screen == selection.screen ? 1 : 0; |
725 | checksel = selection.op && current_screen == selection.screen ? 1 : 0; |
727 | |
726 | |
728 | line_t *line = &ROW(row); |
727 | line_t *line = &ROW(row); |
729 | |
728 | |
… | |
… | |
986 | |
985 | |
987 | if (count == 0) |
986 | if (count == 0) |
988 | return; |
987 | return; |
989 | else if (count > 0) |
988 | else if (count > 0) |
990 | { |
989 | { |
991 | int row = screen.cur.row; |
|
|
992 | |
|
|
993 | line_t &l = ROW(row); |
990 | line_t &l = ROW(screen.cur.row); |
994 | rend_t base_rend = l.r[i]; |
991 | rend_t base_rend = l.r[i]; |
995 | ht &= l.t[i] == ' '; |
992 | ht &= l.t[i] == ' '; |
996 | |
993 | |
997 | for (; ++i < ncol; ) |
994 | for (; ++i < ncol; ) |
998 | if (tabs[i]) |
995 | if (tabs[i]) |
… | |
… | |
1073 | */ |
1070 | */ |
1074 | #if ENABLE_FRILLS |
1071 | #if ENABLE_FRILLS |
1075 | void |
1072 | void |
1076 | rxvt_term::scr_forwardindex () |
1073 | rxvt_term::scr_forwardindex () |
1077 | { |
1074 | { |
1078 | int row; |
|
|
1079 | |
|
|
1080 | if (screen.cur.col < ncol - 1) |
1075 | if (screen.cur.col < ncol - 1) |
1081 | scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); |
1076 | scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); |
1082 | else |
1077 | else |
1083 | { |
1078 | { |
1084 | row = screen.cur.row; |
|
|
1085 | |
|
|
1086 | if (ROW(row).is_longer ()) //TODO//FIXME//LEN |
1079 | if (ROW(screen.cur.row).is_longer ()) //TODO//FIXME//LEN |
1087 | ROW(row).l = ncol; |
1080 | ROW(screen.cur.row).l = ncol; |
1088 | |
1081 | |
1089 | scr_gotorc (0, 0, R_RELATIVE); |
1082 | scr_gotorc (0, 0, R_RELATIVE); |
1090 | scr_insdel_chars (1, DELETE); |
1083 | scr_insdel_chars (1, DELETE); |
1091 | scr_gotorc (0, ncol - 1, R_RELATIVE); |
1084 | scr_gotorc (0, ncol - 1, R_RELATIVE); |
1092 | } |
1085 | } |
… | |
… | |
1175 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
1168 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
1176 | */ |
1169 | */ |
1177 | void |
1170 | void |
1178 | rxvt_term::scr_erase_line (int mode) |
1171 | rxvt_term::scr_erase_line (int mode) |
1179 | { |
1172 | { |
1180 | unsigned int row, col, num; |
1173 | unsigned int col, num; |
1181 | |
1174 | |
1182 | want_refresh = 1; |
1175 | want_refresh = 1; |
1183 | ZERO_SCROLLBACK (); |
1176 | ZERO_SCROLLBACK (); |
1184 | |
1177 | |
1185 | selection_check (1); |
1178 | selection_check (1); |
1186 | |
1179 | |
1187 | row = screen.cur.row; |
1180 | line_t &line = ROW(screen.cur.row); |
1188 | |
1181 | |
1189 | switch (mode) |
1182 | switch (mode) |
1190 | { |
1183 | { |
1191 | case 0: /* erase to end of line */ |
1184 | case 0: /* erase to end of line */ |
1192 | col = screen.cur.col; |
1185 | col = screen.cur.col; |
1193 | num = ncol - col; |
1186 | num = ncol - col; |
1194 | min_it (ROW(row).l, col); |
1187 | min_it (line.l, col); |
1195 | if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) |
1188 | if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) |
1196 | || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) |
1189 | || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) |
1197 | CLEAR_SELECTION (); |
1190 | CLEAR_SELECTION (); |
1198 | break; |
1191 | break; |
1199 | case 1: /* erase to beginning of line */ |
1192 | case 1: /* erase to beginning of line */ |
… | |
… | |
1204 | CLEAR_SELECTION (); |
1197 | CLEAR_SELECTION (); |
1205 | break; |
1198 | break; |
1206 | case 2: /* erase whole line */ |
1199 | case 2: /* erase whole line */ |
1207 | col = 0; |
1200 | col = 0; |
1208 | num = ncol; |
1201 | num = ncol; |
1209 | ROW(row).l = 0; |
1202 | line.l = 0; |
1210 | if (selection.beg.row <= screen.cur.row |
1203 | if (selection.beg.row <= screen.cur.row |
1211 | && selection.end.row >= screen.cur.row) |
1204 | && selection.end.row >= screen.cur.row) |
1212 | CLEAR_SELECTION (); |
1205 | CLEAR_SELECTION (); |
1213 | break; |
1206 | break; |
1214 | default: |
1207 | default: |
1215 | return; |
1208 | return; |
1216 | } |
1209 | } |
1217 | |
1210 | |
1218 | scr_blank_line (ROW(row), col, num, rstyle); |
1211 | scr_blank_line (line, col, num, rstyle); |
1219 | } |
1212 | } |
1220 | |
1213 | |
1221 | /* ------------------------------------------------------------------------- */ |
1214 | /* ------------------------------------------------------------------------- */ |
1222 | /* |
1215 | /* |
1223 | * Erase part of whole of the screen |
1216 | * Erase part of whole of the screen |