From 4c9f144dace484ca99cc84053493ed7b5f6946ac Mon Sep 17 00:00:00 2001 From: Frojdholm Date: Wed, 31 Aug 2022 18:26:21 +0200 Subject: fix: Recalculate completion when going through prompt history (#3193) * fix: Recalculate completion when going through prompt history * Update completion when the prompt line is changed It should not be possible to update the line without also updating the completion since the completion holds an index into the line. * Fix Prompt::with_line recalculate completion with_line was the last function where recalculate completion had to be done manually. This function now also recalculates the completion so that it's impossible to forget. * Exit selection when recalculating completion Keeping the selection index when the completion has been recalculated doesn't make sense. This clears the selection automatically, removing most needs to manually clear it. * Remove &mut on save_filter Co-authored-by: Blaž Hrastnik --- helix-term/tests/test/prompt.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 helix-term/tests/test/prompt.rs (limited to 'helix-term/tests/test') diff --git a/helix-term/tests/test/prompt.rs b/helix-term/tests/test/prompt.rs new file mode 100644 index 00000000..2ab9604c --- /dev/null +++ b/helix-term/tests/test/prompt.rs @@ -0,0 +1,18 @@ +use super::*; + +use helix_term::application::Application; + +#[tokio::test] +async fn test_history_completion() -> anyhow::Result<()> { + test_key_sequence( + &mut Application::new(Args::default(), Config::default())?, + Some(":asdf:theme d"), + Some(&|app| { + assert!(!app.editor.is_err()); + }), + false, + ) + .await?; + + Ok(()) +} -- cgit v1.2.3-70-g09d2