… | |
… | |
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 |
… | |
… | |
329 | int prow = lofs / prev_ncol; |
329 | int prow = lofs / prev_ncol; |
330 | int pcol = lofs % prev_ncol; |
330 | int pcol = lofs % prev_ncol; |
331 | |
331 | |
332 | prow = MOD (p + prow, prev_total_rows); |
332 | prow = MOD (p + prow, prev_total_rows); |
333 | |
333 | |
334 | // we only adjust the cursor _row_, as this seems to upset |
334 | // we only adjust the cursor _row_ and put it into |
|
|
335 | // the topmost line of "long line" it was in, as |
335 | // applications/shells/readline least. |
336 | // this seems to upset applications/shells/readline |
|
|
337 | // least. |
336 | if (prow == ocur.row) |
338 | if (prow == ocur.row) |
337 | screen.cur.row = qrow - (total_rows - nrow); |
339 | screen.cur.row = q - (total_rows - nrow); |
338 | |
340 | |
339 | line_t &pline = old_buf [prow]; |
341 | line_t &pline = old_buf [prow]; |
340 | |
342 | |
341 | int len = min (min (prev_ncol - pcol, ncol - qcol), llen - lofs); |
343 | int len = min (min (prev_ncol - pcol, ncol - qcol), llen - lofs); |
342 | |
344 | |
… | |
… | |
352 | } |
354 | } |
353 | |
355 | |
354 | qline->l = llen < ncol ? llen : MOD (llen - 1, ncol) + 1; |
356 | qline->l = llen < ncol ? llen : MOD (llen - 1, ncol) + 1; |
355 | scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE); |
357 | scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE); |
356 | } |
358 | } |
|
|
359 | while (p != pend && q > 0); |
357 | |
360 | |
358 | term_start = total_rows - nrow; |
361 | term_start = total_rows - nrow; |
359 | view_start = 0; |
|
|
360 | nsaved = term_start - q; |
362 | nsaved = term_start - q; |
361 | |
363 | |
362 | // make sure all terminal lines exist |
364 | // make sure all terminal lines exist |
363 | while (nsaved < 0) |
365 | while (nsaved < 0) |
364 | scr_blank_screen_mem (ROW (-++nsaved), DEFAULT_RSTYLE); |
366 | scr_blank_screen_mem (ROW (-++nsaved), DEFAULT_RSTYLE); |
… | |
… | |
381 | { |
383 | { |
382 | 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); |
383 | } |
385 | } |
384 | |
386 | |
385 | term_start = 0; |
387 | term_start = 0; |
386 | view_start = 0; |
|
|
387 | } |
388 | } |
388 | |
389 | |
389 | #ifdef DEBUG_STRICT |
390 | #ifdef DEBUG_STRICT //TODO: remove |
390 | for (int i = -nsaved; i < nrow; i++) |
391 | for (int i = -nsaved; i < nrow; i++) |
391 | assert (ROW (i).t); |
392 | assert (ROW (i).t); |
392 | #endif |
393 | #endif |
393 | |
394 | |
394 | free (old_buf); |
395 | free (old_buf); |
… | |
… | |
692 | if (len <= 0) /* sanity */ |
693 | if (len <= 0) /* sanity */ |
693 | return; |
694 | return; |
694 | |
695 | |
695 | unsigned char checksel; |
696 | unsigned char checksel; |
696 | unicode_t c; |
697 | unicode_t c; |
697 | int row, last_col; |
698 | int last_col; |
698 | const unicode_t *strend = str + len; |
699 | const unicode_t *strend = str + len; |
699 | |
700 | |
700 | want_refresh = 1; |
701 | want_refresh = 1; |
701 | ZERO_SCROLLBACK (); |
702 | ZERO_SCROLLBACK (); |
702 | last_col = ncol; |
703 | last_col = ncol; |
… | |
… | |
717 | #ifdef DEBUG_STRICT |
718 | #ifdef DEBUG_STRICT |
718 | assert (screen.cur.col < last_col); |
719 | assert (screen.cur.col < last_col); |
719 | assert (screen.cur.row < nrow |
720 | assert (screen.cur.row < nrow |
720 | && screen.cur.row >= -nsaved); |
721 | && screen.cur.row >= -nsaved); |
721 | #endif |
722 | #endif |
722 | row = screen.cur.row; |
723 | int row = screen.cur.row; |
723 | |
724 | |
724 | checksel = selection.op && current_screen == selection.screen ? 1 : 0; |
725 | checksel = selection.op && current_screen == selection.screen ? 1 : 0; |
725 | |
726 | |
726 | line_t *line = &ROW(row); |
727 | line_t *line = &ROW(row); |
727 | |
728 | |
… | |
… | |
984 | |
985 | |
985 | if (count == 0) |
986 | if (count == 0) |
986 | return; |
987 | return; |
987 | else if (count > 0) |
988 | else if (count > 0) |
988 | { |
989 | { |
989 | int row = screen.cur.row; |
|
|
990 | |
|
|
991 | line_t &l = ROW(row); |
990 | line_t &l = ROW(screen.cur.row); |
992 | rend_t base_rend = l.r[i]; |
991 | rend_t base_rend = l.r[i]; |
993 | ht &= l.t[i] == ' '; |
992 | ht &= l.t[i] == ' '; |
994 | |
993 | |
995 | for (; ++i < ncol; ) |
994 | for (; ++i < ncol; ) |
996 | if (tabs[i]) |
995 | if (tabs[i]) |
… | |
… | |
1071 | */ |
1070 | */ |
1072 | #if ENABLE_FRILLS |
1071 | #if ENABLE_FRILLS |
1073 | void |
1072 | void |
1074 | rxvt_term::scr_forwardindex () |
1073 | rxvt_term::scr_forwardindex () |
1075 | { |
1074 | { |
1076 | int row; |
|
|
1077 | |
|
|
1078 | if (screen.cur.col < ncol - 1) |
1075 | if (screen.cur.col < ncol - 1) |
1079 | scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); |
1076 | scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); |
1080 | else |
1077 | else |
1081 | { |
1078 | { |
1082 | row = screen.cur.row; |
|
|
1083 | |
|
|
1084 | if (ROW(row).is_longer ()) //TODO//FIXME//LEN |
1079 | if (ROW(screen.cur.row).is_longer ()) //TODO//FIXME//LEN |
1085 | ROW(row).l = ncol; |
1080 | ROW(screen.cur.row).l = ncol; |
1086 | |
1081 | |
1087 | scr_gotorc (0, 0, R_RELATIVE); |
1082 | scr_gotorc (0, 0, R_RELATIVE); |
1088 | scr_insdel_chars (1, DELETE); |
1083 | scr_insdel_chars (1, DELETE); |
1089 | scr_gotorc (0, ncol - 1, R_RELATIVE); |
1084 | scr_gotorc (0, ncol - 1, R_RELATIVE); |
1090 | } |
1085 | } |
… | |
… | |
1173 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
1168 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
1174 | */ |
1169 | */ |
1175 | void |
1170 | void |
1176 | rxvt_term::scr_erase_line (int mode) |
1171 | rxvt_term::scr_erase_line (int mode) |
1177 | { |
1172 | { |
1178 | unsigned int row, col, num; |
1173 | unsigned int col, num; |
1179 | |
1174 | |
1180 | want_refresh = 1; |
1175 | want_refresh = 1; |
1181 | ZERO_SCROLLBACK (); |
1176 | ZERO_SCROLLBACK (); |
1182 | |
1177 | |
1183 | selection_check (1); |
1178 | selection_check (1); |
1184 | |
1179 | |
1185 | row = screen.cur.row; |
1180 | line_t &line = ROW(screen.cur.row); |
1186 | |
1181 | |
1187 | switch (mode) |
1182 | switch (mode) |
1188 | { |
1183 | { |
1189 | case 0: /* erase to end of line */ |
1184 | case 0: /* erase to end of line */ |
1190 | col = screen.cur.col; |
1185 | col = screen.cur.col; |
1191 | num = ncol - col; |
1186 | num = ncol - col; |
1192 | min_it (ROW(row).l, col); |
1187 | min_it (line.l, col); |
1193 | if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) |
1188 | if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) |
1194 | || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) |
1189 | || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) |
1195 | CLEAR_SELECTION (); |
1190 | CLEAR_SELECTION (); |
1196 | break; |
1191 | break; |
1197 | case 1: /* erase to beginning of line */ |
1192 | case 1: /* erase to beginning of line */ |
… | |
… | |
1202 | CLEAR_SELECTION (); |
1197 | CLEAR_SELECTION (); |
1203 | break; |
1198 | break; |
1204 | case 2: /* erase whole line */ |
1199 | case 2: /* erase whole line */ |
1205 | col = 0; |
1200 | col = 0; |
1206 | num = ncol; |
1201 | num = ncol; |
1207 | ROW(row).l = 0; |
1202 | line.l = 0; |
1208 | if (selection.beg.row <= screen.cur.row |
1203 | if (selection.beg.row <= screen.cur.row |
1209 | && selection.end.row >= screen.cur.row) |
1204 | && selection.end.row >= screen.cur.row) |
1210 | CLEAR_SELECTION (); |
1205 | CLEAR_SELECTION (); |
1211 | break; |
1206 | break; |
1212 | default: |
1207 | default: |
1213 | return; |
1208 | return; |
1214 | } |
1209 | } |
1215 | |
1210 | |
1216 | scr_blank_line (ROW(row), col, num, rstyle); |
1211 | scr_blank_line (line, col, num, rstyle); |
1217 | } |
1212 | } |
1218 | |
1213 | |
1219 | /* ------------------------------------------------------------------------- */ |
1214 | /* ------------------------------------------------------------------------- */ |
1220 | /* |
1215 | /* |
1221 | * Erase part of whole of the screen |
1216 | * Erase part of whole of the screen |