diff options
author | Frojdholm | 2022-08-31 16:26:21 +0000 |
---|---|---|
committer | GitHub | 2022-08-31 16:26:21 +0000 |
commit | 4c9f144dace484ca99cc84053493ed7b5f6946ac (patch) | |
tree | 8bff0da654a9c2ecd33fa1ad7530140a68e0667d /helix-term/tests | |
parent | e3e71fa36be14659f0eabe1d4c80ef7e68135a6a (diff) |
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 <blaz@mxxn.io>
Diffstat (limited to 'helix-term/tests')
-rw-r--r-- | helix-term/tests/integration.rs | 1 | ||||
-rw-r--r-- | helix-term/tests/test/prompt.rs | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/helix-term/tests/integration.rs b/helix-term/tests/integration.rs index 11bc4e4c..8969e976 100644 --- a/helix-term/tests/integration.rs +++ b/helix-term/tests/integration.rs @@ -21,5 +21,6 @@ mod test { mod auto_pairs; mod commands; mod movement; + mod prompt; mod write; } 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<ret>:theme d<C-n><tab>"), + Some(&|app| { + assert!(!app.editor.is_err()); + }), + false, + ) + .await?; + + Ok(()) +} |