-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
windows: keyToString(): fix string conversion (for real)
I must've been sleeping while writing 2ce69ef, because while it "fixed" the error, the intent here obviously is to return the actual character, not the number ':-) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- Loading branch information
Showing
2 changed files
with
24 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package windowsconsole | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/Azure/go-ansiterm" | ||
"github.com/Azure/go-ansiterm/winterm" | ||
) | ||
|
||
func TestKeyToString(t *testing.T) { | ||
ke := &winterm.KEY_EVENT_RECORD{ | ||
KeyDown: 1, | ||
ControlKeyState: winterm.LEFT_ALT_PRESSED, | ||
UnicodeChar: 65, // capital A | ||
} | ||
|
||
const expected = ansiterm.KEY_ESC_N + "a" | ||
out := keyToString(ke, nil) | ||
if out != expected { | ||
t.Errorf("expected %s, got %s", expected, out) | ||
} | ||
} |