Skip to content

Commit

Permalink
Fix crash when using backspace
Browse files Browse the repository at this point in the history
  • Loading branch information
nodauf committed Oct 16, 2021
1 parent e2dbd6c commit 2d1e57f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/terminal/terminal-utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,11 @@ func (terminal *Terminal) streamCopy(src io.Reader, dst io.Writer, toRemote bool
// backspace
case byte(127):
// Remove the last character
command = command[:len(command)-1]
if len(command) > 1 {
command = command[:len(command)-1]
} else {
command = ""
}
_, err = dst.Write(buf[0:nBytes])
continue
}
Expand Down

0 comments on commit 2d1e57f

Please sign in to comment.