aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-07-03 20:21:44 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-07-03 20:21:44 +0000
commit35d5035f614493196e3b93e2b60d6f88df75e067 (patch)
treef597eff1e1f15317ab156a34fc897f7dd6d303c8
parentcsi: cleanup (diff)
csi: fix bug: cursor horizontal absolute (<ESC> Pn G) was off-by-one
-rw-r--r--csi.c8
1 files 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;
}