Add control-d as an alternate key binding to close the TUI to fix #61 (plus some tests)

This commit is contained in:
David Dworken
2022-12-18 00:27:29 -08:00
parent d15376f37d
commit 5f95ac48a4
3 changed files with 17 additions and 1 deletions

View File

@@ -1884,6 +1884,18 @@ func TestTui(t *testing.T) {
})
out = strings.TrimSpace(strings.Split(out, "hishtory tquery")[1])
compareGoldens(t, out, "TestTui-LeftScroll")
// Check that we can exit the TUI via pressing esc
out = captureTerminalOutput(t, tester, []string{
"hishtory SPACE tquery ENTER",
"Escape",
})
if strings.Contains(out, "Search Query:") {
t.Fatalf("unexpected out=\n%s", out)
}
if !testutils.IsGithubAction() {
compareGoldens(t, out, "TestTui-Exit")
}
}
func captureTerminalOutput(t *testing.T, tester shellTester, commands []string) string {