From b8c7dfba5c3fd6a2bd0ac28663c0c5d55ee2ed4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 14 Jul 2020 11:25:06 +0200 Subject: [PATCH] term: line-wrap: manually set cursor row+col line-wrap is in the hot path, and term_cursor_down/left adds additional checks that we don't need. --- terminal.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/terminal.c b/terminal.c index 76318d90..99ef16d7 100644 --- a/terminal.c +++ b/terminal.c @@ -2354,11 +2354,15 @@ print_linewrap(struct terminal *term) return; } + term->grid->cursor.lcf = false; if (term->grid->cursor.point.row == term->scroll_region.end - 1) term_scroll(term, 1); - else - term_cursor_down(term, 1); - term_cursor_left(term, term->grid->cursor.point.col); + else { + assert(term->grid->cursor.point.row < term->scroll_region.end - 1); + term->grid->cursor.point.row++; + } + + term->grid->cursor.point.col = 0; } static inline void