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/src/commands/dap.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'helix-term/src/commands/dap.rs') 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)); }); -- cgit v1.2.3-70-g09d2