Add test to check if escapeKeys is empty

Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
This commit is contained in:
Patrik Cyvoct 2018-04-30 13:27:21 +02:00
parent f1f25b8d14
commit e1cfb29255
No known key found for this signature in database
GPG Key ID: D9105E724B0143B2
1 changed files with 4 additions and 1 deletions

View File

@ -13,7 +13,6 @@
// CHANGES: // CHANGES:
// - update package // - update package
package gottyclient package gottyclient
import ( import (
@ -50,6 +49,10 @@ func NewEscapeProxy(r io.Reader, escapeKeys []byte) io.Reader {
func (r *escapeProxy) Read(buf []byte) (int, error) { func (r *escapeProxy) Read(buf []byte) (int, error) {
nr, err := r.r.Read(buf) nr, err := r.r.Read(buf)
if len(r.escapeKeys) == 0 {
return nr, err
}
preserve := func() { preserve := func() {
// this preserves the original key presses in the passed in buffer // this preserves the original key presses in the passed in buffer
nr += r.escapeKeyPos nr += r.escapeKeyPos