From 35d5035f614493196e3b93e2b60d6f88df75e067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 3 Jul 2019 22:21:44 +0200 Subject: [PATCH] csi: fix bug: cursor horizontal absolute ( Pn G) was off-by-one --- csi.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/csi.c b/csi.c index 681d31f0..4b545d31 100644 --- a/csi.c +++ b/csi.c @@ -314,12 +314,8 @@ csi_dispatch(struct terminal *term, uint8_t final) case 'G': { /* Cursor horizontal absolute */ - int col = param_get(term, 0, 1); - - if (col > term->cols) - col = term->cols; - - term_cursor_to(term, term->cursor.row, col); + int col = min(param_get(term, 0, 1), term->cols); + term_cursor_to(term, term->cursor.row, col - 1); break; }