Skip to content

Commit 87024f3

Browse files
committed
sshd/terminal: Clear screen below on enterClear
1 parent c058f72 commit 87024f3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sshd/terminal/terminal.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,11 @@ func (t *Terminal) clearLineToRight() {
322322
t.queue(op)
323323
}
324324

325+
func (t *Terminal) clearScreenBelow() {
326+
op := []rune{keyEscape, '[', 'J'}
327+
t.queue(op)
328+
}
329+
325330
const maxLineLength = 4096
326331

327332
func (t *Terminal) setLine(newLine []rune, newPos int) {
@@ -528,6 +533,7 @@ func (t *Terminal) handleKey(key rune) (line string, ok bool) {
528533
// prompt is retained.
529534
t.moveCursorToPos(0)
530535
t.clearLineToRight()
536+
t.clearScreenBelow() // Necessary for wrapped lines
531537
} else {
532538
// Pushing the line up resets the cursor to 0,0 and we render a
533539
// fresh prompt.

0 commit comments

Comments
 (0)