Skip to content

Commit

Permalink
fix: renderer: use newline instead of cud1 to move cursor down (#1323)
Browse files Browse the repository at this point in the history
* fix: renderer: use newline instead of cud1 to move cursor down

Using cud1 (`\x1b[B`) won't scroll the terminal if the cursor is already
at the bottom of the screen. Instead, use a newline character to move
the cursor down and scroll the terminal if necessary.

Fixes: #1322

* chore(examples): update tesdata
  • Loading branch information
aymanbagabas authored Feb 10, 2025
1 parent cebad5b commit 771a101
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion examples/simple/testdata/TestApp.golden
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

To quit sooner press ctrl-c, or press ctrl-z to suspend...
Hi. This program will exit in 9 seconds.
[?2004l[?25h[?1002l[?1003l[?1006l


[?2004l[?25h[?1002l[?1003l[?1006l
Expand Down
2 changes: 1 addition & 1 deletion standard_renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func (r *standardRenderer) flush() {
if _, ignore := r.ignoreLines[i]; ignore || canSkip {
// Unless this is the last line, move the cursor down.
if i < len(newLines)-1 {
buf.WriteString(ansi.CUD1)
buf.WriteByte('\n')
}
continue
}
Expand Down

0 comments on commit 771a101

Please sign in to comment.