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/src/commands | |
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/src/commands')
-rw-r--r-- | helix-term/src/commands/dap.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/helix-term/src/commands/dap.rs b/helix-term/src/commands/dap.rs index 1c780c1f..12a3fbc7 100644 --- a/helix-term/src/commands/dap.rs +++ b/helix-term/src/commands/dap.rs @@ -582,7 +582,7 @@ pub fn dap_edit_condition(cx: &mut Context) { None => return, }; let callback = Box::pin(async move { - let call: Callback = Box::new(move |_editor, compositor| { + let call: Callback = Box::new(move |editor, compositor| { let mut prompt = Prompt::new( "condition:".into(), None, @@ -607,7 +607,7 @@ pub fn dap_edit_condition(cx: &mut Context) { }, ); if let Some(condition) = breakpoint.condition { - prompt.insert_str(&condition) + prompt.insert_str(&condition, editor) } compositor.push(Box::new(prompt)); }); @@ -624,7 +624,7 @@ pub fn dap_edit_log(cx: &mut Context) { None => return, }; let callback = Box::pin(async move { - let call: Callback = Box::new(move |_editor, compositor| { + let call: Callback = Box::new(move |editor, compositor| { let mut prompt = Prompt::new( "log-message:".into(), None, @@ -648,7 +648,7 @@ pub fn dap_edit_log(cx: &mut Context) { }, ); if let Some(log_message) = breakpoint.log_message { - prompt.insert_str(&log_message); + prompt.insert_str(&log_message, editor); } compositor.push(Box::new(prompt)); }); |