Skip to content

Commit

Permalink
Support backspace character when using custom command
Browse files Browse the repository at this point in the history
  • Loading branch information
nodauf committed Sep 28, 2021
1 parent 9e85abc commit 66f833b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/terminal/terminal-utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,15 @@ func (terminal *Terminal) streamCopy(src io.Reader, dst io.Writer, toRemote bool
}
//if writing stdin -> target
if toRemote {
// Switch to parse special character
switch buf[0] {
// backspace
case byte(127):
// Remove the last character
command = command[:len(command)-1]
_, err = dst.Write(buf[0:nBytes])
continue
}
// Remove null byte and line feed (\x10) which was send sometimes between each character
command += string(bytes.Trim(bytes.Trim(buf, string(utils.Nullbyte)), string(utils.Newline)))
//Contains new line
Expand Down

0 comments on commit 66f833b

Please sign in to comment.