mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-04-18 17:57:41 +03:00
sshd/terminal: Clear screen below on enterClear
This commit is contained in:
parent
c058f72fe4
commit
87024f3ded
@ -322,6 +322,11 @@ func (t *Terminal) clearLineToRight() {
|
|||||||
t.queue(op)
|
t.queue(op)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *Terminal) clearScreenBelow() {
|
||||||
|
op := []rune{keyEscape, '[', 'J'}
|
||||||
|
t.queue(op)
|
||||||
|
}
|
||||||
|
|
||||||
const maxLineLength = 4096
|
const maxLineLength = 4096
|
||||||
|
|
||||||
func (t *Terminal) setLine(newLine []rune, newPos int) {
|
func (t *Terminal) setLine(newLine []rune, newPos int) {
|
||||||
@ -528,6 +533,7 @@ func (t *Terminal) handleKey(key rune) (line string, ok bool) {
|
|||||||
// prompt is retained.
|
// prompt is retained.
|
||||||
t.moveCursorToPos(0)
|
t.moveCursorToPos(0)
|
||||||
t.clearLineToRight()
|
t.clearLineToRight()
|
||||||
|
t.clearScreenBelow() // Necessary for wrapped lines
|
||||||
} else {
|
} else {
|
||||||
// Pushing the line up resets the cursor to 0,0 and we render a
|
// Pushing the line up resets the cursor to 0,0 and we render a
|
||||||
// fresh prompt.
|
// fresh prompt.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user