mirror of
https://github.com/ddworken/hishtory.git
synced 2024-11-22 16:24:00 +01:00
Fix bug where typing 'foo:' and then hitting backspace would lead to the error still being displayed
This commit is contained in:
parent
091f37e4a2
commit
b69788967f
@ -1839,7 +1839,7 @@ func TestTui(t *testing.T) {
|
||||
out = strings.TrimSpace(strings.Split(out, "hishtory tquery")[1])
|
||||
testutils.CompareGoldens(t, out, "TestTui-InitialInvalidSearch")
|
||||
|
||||
// Check the output when the initial search is invalid
|
||||
// Check the output when the search is invalid
|
||||
out = captureTerminalOutput(t, tester, []string{
|
||||
"hishtory SPACE tquery ENTER",
|
||||
"ls:",
|
||||
@ -1847,6 +1847,14 @@ func TestTui(t *testing.T) {
|
||||
out = strings.TrimSpace(strings.Split(out, "hishtory tquery")[1])
|
||||
testutils.CompareGoldens(t, out, "TestTui-InvalidSearch")
|
||||
|
||||
// Check the output when the search is invalid and then edited to become valid
|
||||
out = captureTerminalOutput(t, tester, []string{
|
||||
"hishtory SPACE tquery ENTER",
|
||||
"ls: BSpace",
|
||||
})
|
||||
out = strings.TrimSpace(strings.Split(out, "hishtory tquery")[1])
|
||||
testutils.CompareGoldens(t, out, "TestTui-InvalidSearchBecomesValid")
|
||||
|
||||
// Check the output when the size is smaller
|
||||
out = captureTerminalOutputWithShellNameAndDimensions(t, tester, tester.ShellName(), 100, 20, []TmuxCommand{
|
||||
{Keys: "hishtory SPACE tquery ENTER"},
|
||||
|
26
client/lib/goldens/TestTui-InvalidSearchBecomesValid
Normal file
26
client/lib/goldens/TestTui-InvalidSearchBecomesValid
Normal file
@ -0,0 +1,26 @@
|
||||
Search Query: > ls
|
||||
|
||||
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Hostname CWD Timestamp Runtime Exit Code Command │
|
||||
│────────────────────────────────────────────────────────────────────────────────────────────────────────│
|
||||
│ localhost /tmp/ Oct 17 2022 21:43:16 PDT 3s 2 ls ~/ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
└────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
@ -94,7 +94,7 @@ func (m model) Init() tea.Cmd {
|
||||
}
|
||||
|
||||
func runQueryAndUpdateTable(m model, updateTable bool) model {
|
||||
if (m.runQuery != nil && *m.runQuery != m.lastQuery) || updateTable {
|
||||
if (m.runQuery != nil && *m.runQuery != m.lastQuery) || updateTable || m.searchErr != nil {
|
||||
if m.runQuery == nil {
|
||||
m.runQuery = &m.lastQuery
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user