Skip to content

Commit 5913cf6

Browse files
sudadeadprogram
authored andcommitted
Implement the CUB Cursor Back
1 parent 6d948bc commit 5913cf6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tinyterm.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ func (t *Terminal) putchar(b byte) {
208208
// CUF: Cursor Forward
209209
case 'D':
210210
// CUB: Cursor Back
211+
t.cursorBack()
211212
case 'E':
212213
// CNL: Cursor Next Line
213214
case 'F':
@@ -314,6 +315,12 @@ func (t *Terminal) drawchar(b byte) {
314315
t.next += 1
315316
}
316317

318+
func (t *Terminal) cursorBack() {
319+
if t.next > 0 {
320+
t.next -= 1
321+
}
322+
}
323+
317324
func (t *Terminal) cr() {
318325
}
319326

0 commit comments

Comments
 (0)