Skip to content

Commit

Permalink
Ensure cursor goes to home after
Browse files Browse the repository at this point in the history
  • Loading branch information
jspc committed Oct 28, 2022
1 parent bbb0138 commit 9c4d1db
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/cga/cga.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ func setCursorColumn(n int) {
getbackend().SetPos(pos)
}

func setCursorHome() {
getbackend().SetPos(0)
}

func eraseLine(method EraseMethod) {
backend := getbackend()
pos := backend.GetPos()
Expand Down Expand Up @@ -69,9 +73,10 @@ func writeCSI(action byte, params []string) {
// Hopefully nobody ever uses my fork if they expect that functionality
case 'J':
eraseLine(EraseMethod_All)
setCursorHome()

default:
panic("unsupported CSI action")
// ignore
}
}

Expand Down Expand Up @@ -103,6 +108,7 @@ func WriteByte(ch byte) {
case errInvalidChar:
parser.Reset()
default:
getbackend().WriteByte(ch)
// ignore
}
}

0 comments on commit 9c4d1db

Please sign in to comment.