mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-24 09:05:48 -04:00
render: resize: do linefeed *after* updating cursor position
This commit is contained in:
parent
a96a6c2c58
commit
4b328ead5e
1 changed files with 6 additions and 2 deletions
8
render.c
8
render.c
|
|
@ -1057,7 +1057,7 @@ reflow(struct terminal *term, struct row **new_grid, int new_cols, int new_rows,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (empty_count < old_cols &&
|
if (empty_count < old_cols &&
|
||||||
r < old_rows - 1 &&
|
//r < old_rows - 1 &&
|
||||||
(old_row->cells[old_cols - 1].wc == 0 ||
|
(old_row->cells[old_cols - 1].wc == 0 ||
|
||||||
old_row->cells[old_cols - 1].attrs.linefeed))
|
old_row->cells[old_cols - 1].attrs.linefeed))
|
||||||
{
|
{
|
||||||
|
|
@ -1230,16 +1230,20 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
|
||||||
cursor_row += term->grid->num_rows;
|
cursor_row += term->grid->num_rows;
|
||||||
|
|
||||||
/* Heuristic to prevent a new prompt from being printed a new line */
|
/* Heuristic to prevent a new prompt from being printed a new line */
|
||||||
|
bool do_linefeed = false;
|
||||||
if (term->cursor.point.col > 0)
|
if (term->cursor.point.col > 0)
|
||||||
cursor_row--;
|
cursor_row--;
|
||||||
else if (cursor_row >= term->rows)
|
else if (cursor_row >= term->rows)
|
||||||
term_linefeed(term);
|
do_linefeed = true;
|
||||||
|
|
||||||
term_cursor_to(
|
term_cursor_to(
|
||||||
term,
|
term,
|
||||||
min(max(cursor_row, 0), term->rows - 1),
|
min(max(cursor_row, 0), term->rows - 1),
|
||||||
min(term->cursor.point.col, term->cols - 1));
|
min(term->cursor.point.col, term->cols - 1));
|
||||||
|
|
||||||
|
if (do_linefeed)
|
||||||
|
term_linefeed(term);
|
||||||
|
|
||||||
term->render.last_cursor.cell = NULL;
|
term->render.last_cursor.cell = NULL;
|
||||||
tll_free(term->normal.scroll_damage);
|
tll_free(term->normal.scroll_damage);
|
||||||
tll_free(term->alt.scroll_damage);
|
tll_free(term->alt.scroll_damage);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue