From da0a65d4999133928a160a282a6f0496ff6d0af7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Mon, 24 Jun 2019 20:08:44 +0200 Subject: [PATCH] csi: implement cursor horizontal absolute --- csi.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/csi.c b/csi.c index bfd7b575..680dd363 100644 --- a/csi.c +++ b/csi.c @@ -295,6 +295,19 @@ csi_dispatch(struct terminal *term, uint8_t final) break; } + case 'G': { + /* Cursor horizontal absolute */ + int col = term->vt.params.idx > 0 ? term->vt.params.v[0].value : 1; + if (col == 0) + col = 1; + + if (col > term->grid.cols) + col = term->grid.cols; + + grid_cursor_to(&term->grid, term->grid.cursor.row, col); + break; + } + case 'H': { /* Move cursor */ int row = term->vt.params.idx > 0 ? term->vt.params.v[0].value : 1;