Add SearchHistory to command palette

This makes vim mode significantly nicer to use
This commit is contained in:
Conrad Irwin 2025-08-14 10:28:53 -06:00
parent e5402d5464
commit 18c5cbacd6
5 changed files with 136 additions and 2 deletions

View file

@ -2584,4 +2584,46 @@ mod test {
assert_active_item(workspace, path!("/root/dir/file_3.rs"), "", cx);
});
}
#[gpui::test]
async fn test_command_history(cx: &mut TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state(indoc! {"
The quick
brown fox
ˇjumps over
the lazy dog
"})
.await;
cx.simulate_shared_keystrokes(": s / o / a enter").await;
cx.shared_state().await.assert_eq(indoc! {"
The quick
brown fox
ˇjumps aver
the lazy dog
"});
// n.b ^ fixes a selection mismatch after u. should be removable eventually
cx.simulate_shared_keystrokes("u ^").await;
cx.shared_state().await.assert_eq(indoc! {"
The quick
brown fox
ˇjumps over
the lazy dog
"});
cx.simulate_shared_keystrokes(": up backspace e enter")
.await;
cx.shared_state().await.assert_eq(indoc! {"
The quick
brown fox
ˇjumps ever
the lazy dog
"});
}
}

View file

@ -0,0 +1,18 @@
{"Put":{"state":"The quick\nbrown fox\nˇjumps over\nthe lazy dog\n"}}
{"Key":":"}
{"Key":"s"}
{"Key":"/"}
{"Key":"o"}
{"Key":"/"}
{"Key":"a"}
{"Key":"enter"}
{"Get":{"state":"The quick\nbrown fox\nˇjumps aver\nthe lazy dog\n","mode":"Normal"}}
{"Key":"u"}
{"Key":"^"}
{"Get":{"state":"The quick\nbrown fox\nˇjumps over\nthe lazy dog\n","mode":"Normal"}}
{"Key":":"}
{"Key":"up"}
{"Key":"backspace"}
{"Key":"e"}
{"Key":"enter"}
{"Get":{"state":"The quick\nbrown fox\nˇjumps ever\nthe lazy dog\n","mode":"Normal"}}