Skip to content

Commit

Permalink
fix: height can no longer be negative on non windows systems
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinJWendt committed May 8, 2021
1 parent a27a12e commit 5eeccbc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cursor.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ func Up(n int) {
// Down moves the cursor n lines down relative to the current position.
func Down(n int) {
fmt.Printf("\x1b[%dB", n)
height -= n
if height-n < 0 {
height = 0
} else {
height -= n
}
}

// Right moves the cursor n characters to the right relative to the current position.
Expand Down

0 comments on commit 5eeccbc

Please sign in to comment.