render: resize; heuristics to prevent prompt from being printed on a newline

This commit is contained in:
Daniel Eklöf 2020-02-12 20:26:14 +01:00
parent ea52d3e570
commit a96a6c2c58
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -1229,15 +1229,15 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
while (cursor_row < 0)
cursor_row += term->grid->num_rows;
#if 0
if (term->cursor.point.col < term->cols - 1)
/* Heuristic to prevent a new prompt from being printed a new line */
if (term->cursor.point.col > 0)
cursor_row--;
#endif
else if (cursor_row >= term->rows)
term_linefeed(term);
assert(cursor_row < term->rows);
term_cursor_to(
term,
max(cursor_row, 0),
min(max(cursor_row, 0), term->rows - 1),
min(term->cursor.point.col, term->cols - 1));
term->render.last_cursor.cell = NULL;