mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-15 22:05:24 -05:00
term: make sure to update 'current row' when restoring saved cursor
This commit is contained in:
parent
f7519b5725
commit
f5a6304850
4 changed files with 20 additions and 3 deletions
11
csi.c
11
csi.c
|
|
@ -576,6 +576,14 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
|||
break;
|
||||
}
|
||||
|
||||
case 's':
|
||||
term->saved_cursor = term->cursor;
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
term_restore_cursor(term);
|
||||
break;
|
||||
|
||||
case 't': {
|
||||
unsigned param = vt_param_get(term, 0, 0);
|
||||
|
||||
|
|
@ -794,8 +802,7 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
|||
if (term->grid == &term->alt) {
|
||||
term->grid = &term->normal;
|
||||
|
||||
term->cursor = term->saved_cursor;
|
||||
term_cursor_to(term, term->cursor.row, term->cursor.col);
|
||||
term_restore_cursor(term);
|
||||
|
||||
tll_free(term->alt.damage);
|
||||
tll_free(term->alt.scroll_damage);
|
||||
|
|
|
|||
|
|
@ -267,6 +267,14 @@ term_reverse_index(struct terminal *term)
|
|||
term_cursor_up(term, 1);
|
||||
}
|
||||
|
||||
void
|
||||
term_restore_cursor(struct terminal *term)
|
||||
{
|
||||
int row = min(term->saved_cursor.row, term->rows - 1);
|
||||
int col = min(term->saved_cursor.col, term->cols - 1);
|
||||
term_cursor_to(term, row, col);
|
||||
}
|
||||
|
||||
void
|
||||
term_focus_in(struct terminal *term)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -346,6 +346,8 @@ void term_scroll_reverse_partial(
|
|||
void term_linefeed(struct terminal *term);
|
||||
void term_reverse_index(struct terminal *term);
|
||||
|
||||
void term_restore_cursor(struct terminal *term);
|
||||
|
||||
void term_focus_in(struct terminal *term);
|
||||
void term_focus_out(struct terminal *term);
|
||||
void term_mouse_down(struct terminal *term, int button, int row, int col,
|
||||
|
|
|
|||
2
vt.c
2
vt.c
|
|
@ -597,7 +597,7 @@ esc_dispatch(struct terminal *term, uint8_t final)
|
|||
break;
|
||||
|
||||
case '8':
|
||||
term->cursor = term->saved_cursor;
|
||||
term_restore_cursor(term);
|
||||
term->vt.attrs = term->vt.saved_attrs;
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue