go.crypto/ssh/terminal: handle ^W, ^K and ^H

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13207043
This commit is contained in:
Adam Langley
2013-08-28 07:36:04 -04:00
parent c2c80b64c0
commit b725ff72eb
2 changed files with 130 additions and 40 deletions
+37 -1
View File
@@ -101,11 +101,47 @@ var keyPressTests = []struct {
line: "line1xxx",
throwAwayLines: 2,
},
{
in: "\027\r",
line: "",
},
{
in: "a\027\r",
line: "",
},
{
in: "a \027\r",
line: "",
},
{
in: "a b\027\r",
line: "a ",
},
{
in: "a b \027\r",
line: "a ",
},
{
in: "one two thr\x1b[D\027\r",
line: "one two r",
},
{
in: "\013\r",
line: "",
},
{
in: "a\013\r",
line: "a",
},
{
in: "ab\x1b[D\013\r",
line: "a",
},
}
func TestKeyPresses(t *testing.T) {
for i, test := range keyPressTests {
for j := 0; j < len(test.in); j++ {
for j := 1; j < len(test.in); j++ {
c := &MockTerminal{
toSend: []byte(test.in),
bytesPerRead: j,