From 287a29b3444f9e35cf9b972d731bdafa13093b57 Mon Sep 17 00:00:00 2001 From: Wojtek Siudzinski Date: Fri, 4 Jul 2025 23:58:43 +0200 Subject: [PATCH] Implement the CUB Cursor Back --- tinyterm.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tinyterm.go b/tinyterm.go index 9625fc4..bff54ae 100644 --- a/tinyterm.go +++ b/tinyterm.go @@ -208,6 +208,7 @@ func (t *Terminal) putchar(b byte) { // CUF: Cursor Forward case 'D': // CUB: Cursor Back + t.cursorBack() case 'E': // CNL: Cursor Next Line case 'F': @@ -314,6 +315,12 @@ func (t *Terminal) drawchar(b byte) { t.next += 1 } +func (t *Terminal) cursorBack() { + if t.next > 0 { + t.next -= 1 + } +} + func (t *Terminal) cr() { }