[PATCH 11/20] fbconsole: implement CSI A/B/C/D cursor movement sequences

Ahmad Fatoum a.fatoum at barebox.org
Sun May 3 01:33:13 PDT 2026


The framebuffer console should be able to display everything that
existing barebox commands can output to it.

The 2048 command makes use of the cursor movement sequences, so
implement them.

Link: https://terminalguide.namepad.de/seq/csi_ca/
Link: https://terminalguide.namepad.de/seq/csi_cb/
Link: https://terminalguide.namepad.de/seq/csi_cc/
Link: https://terminalguide.namepad.de/seq/csi_cd/

Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
 drivers/video/fbconsole.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/video/fbconsole.c b/drivers/video/fbconsole.c
index 1c4418757b43..ad3c66b75737 100644
--- a/drivers/video/fbconsole.c
+++ b/drivers/video/fbconsole.c
@@ -638,6 +638,28 @@ static bool fbc_parse_csi(struct fbc_priv *priv)
 
 		toggle_cursor_visibility(priv);
 		return true;
+	case 'A' ... 'D': {
+		pos = simple_strtoul(priv->csi, &end, 10) ?: 1;
+		toggle_cursor_visibility(priv);
+
+		switch (last) {
+		case 'A': /* cursor up */
+			fbc_set_cursor_row(priv, priv->cur.y - pos);
+			break;
+		case 'B': /* cursor down */
+			fbc_set_cursor_row(priv, priv->cur.y + pos);
+			break;
+		case 'C': /* cursor forward */
+			fbc_set_cursor_col(priv, priv->cur.x + pos);
+			break;
+		case 'D': /* cursor back */
+			fbc_set_cursor_col(priv, priv->cur.x - pos);
+			break;
+		}
+
+		toggle_cursor_visibility(priv);
+		return true;
+	}
 	case 'K':
 		pos = simple_strtoul(priv->csi, &end, 10);
 		toggle_cursor_visibility(priv);
-- 
2.47.3




More information about the barebox mailing list