From 24f12c7b5e753a5152eac44da9024954d43250e9 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Fri, 16 Jun 2023 16:33:15 +0200 Subject: term: add term_cursor_col() Set cursor column, absolute. term_cursor_to() needs to reload the current row pointer, and is thus not very effective when we only need to modify the column. --- terminal.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index dd4c627c..3beffcf3 100644 --- a/terminal.c +++ b/terminal.c @@ -2557,6 +2557,15 @@ term_cursor_home(struct terminal *term) term_cursor_to(term, term_row_rel_to_abs(term, 0), 0); } +void +term_cursor_col(struct terminal *term, int col) +{ + xassert(col < term->cols); + + term->grid->cursor.lcf = false; + term->grid->cursor.point.col = col; +} + void term_cursor_left(struct terminal *term, int count) { -- cgit v1.3