From a96a6c2c581b7046f81a600f42327691234ad1f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 12 Feb 2020 20:26:14 +0100 Subject: [PATCH] render: resize; heuristics to prevent prompt from being printed on a newline --- render.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/render.c b/render.c index 27dfb86c..6c7c5ee4 100644 --- a/render.c +++ b/render.c @@ -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;