on master help sign in
dap: Remove the prompt line parameter, use insert_str instead
0eadeabBlaž Hrastnik
helix-term/src/commands.rs−4
@@ -2839,7 +2839,6 @@ fn command_mode(cx: &mut Context) {
2839 .set_error(format!("no such command: '{}'", parts[0]));
2839 .set_error(format!("no such command: '{}'", parts[0]));
2840 };
2840 };
2841 },
2841 },
2842− None,
2843 );
2842 );
2844 prompt.doc_fn = Box::new(|input: &str| {
2843 prompt.doc_fn = Box::new(|input: &str| {
2845 let part = input.split(' ').next().unwrap_or_default();
2844 let part = input.split(' ').next().unwrap_or_default();
@@ -5440,7 +5439,6 @@ fn shell_keep_pipe(cx: &mut Context) {
5440 let index = index.unwrap_or_else(|| ranges.len() - 1);
5439 let index = index.unwrap_or_else(|| ranges.len() - 1);
5441 doc.set_selection(view.id, Selection::new(ranges, index));
5440 doc.set_selection(view.id, Selection::new(ranges, index));
5442 },
5441 },
5443− None,
5444 );
5442 );
5445
5443
5446 cx.push_layer(Box::new(prompt));
5444 cx.push_layer(Box::new(prompt));
@@ -5544,7 +5542,6 @@ fn shell(cx: &mut Context, prompt: Cow<'static, str>, behavior: ShellBehavior) {
5544 // make sure cursor is in view and update scroll as well
5542 // make sure cursor is in view and update scroll as well
5545 view.ensure_cursor_in_view(doc, cx.editor.config.scrolloff);
5543 view.ensure_cursor_in_view(doc, cx.editor.config.scrolloff);
5546 },
5544 },
5547− None,
5548 );
5545 );
5549
5546
5550 cx.push_layer(Box::new(prompt));
5547 cx.push_layer(Box::new(prompt));
@@ -5622,7 +5619,6 @@ fn rename_symbol(cx: &mut Context) {
5622 log::debug!("Edits from LSP: {:?}", edits);
5619 log::debug!("Edits from LSP: {:?}", edits);
5623 apply_workspace_edit(&mut cx.editor, offset_encoding, &edits);
5620 apply_workspace_edit(&mut cx.editor, offset_encoding, &edits);
5624 },
5621 },
5625− None,
5626 );
5622 );
5627 cx.push_layer(Box::new(prompt));
5623 cx.push_layer(Box::new(prompt));
5628}
5624}
helix-term/src/commands/dap.rs+10−9
@@ -386,7 +386,6 @@ fn debug_parameter_prompt(
386 );
386 );
387 }
387 }
388 },
388 },
389− None,
390 )
389 )
391}
390}
392
391
@@ -638,9 +637,8 @@ pub fn dap_edit_condition(cx: &mut Context) {
638 let callback = Box::pin(async move {
637 let callback = Box::pin(async move {
639 let call: Callback =
638 let call: Callback =
640 Box::new(move |_editor: &mut Editor, compositor: &mut Compositor| {
639 Box::new(move |_editor: &mut Editor, compositor: &mut Compositor| {
641− let condition = breakpoint.condition;
642− let prompt = Prompt::new(
640+ let mut prompt = Prompt::new(
643− "condition: ".into(),
641+ "condition:".into(),
644 None,
642 None,
645 |_input: &str| Vec::new(),
643 |_input: &str| Vec::new(),
646 move |cx: &mut crate::compositor::Context,
644 move |cx: &mut crate::compositor::Context,
@@ -699,8 +697,10 @@ pub fn dap_edit_condition(cx: &mut Context) {
699 }
697 }
700 }
698 }
701 },
699 },
702− condition,
703 );
700 );
701+ if let Some(condition) = breakpoint.condition {
702+ prompt.insert_str(&condition)
703+ }
704 compositor.push(Box::new(prompt));
704 compositor.push(Box::new(prompt));
705 });
705 });
706 Ok(call)
706 Ok(call)
@@ -714,9 +714,8 @@ pub fn dap_edit_log(cx: &mut Context) {
714 let callback = Box::pin(async move {
714 let callback = Box::pin(async move {
715 let call: Callback =
715 let call: Callback =
716 Box::new(move |_editor: &mut Editor, compositor: &mut Compositor| {
716 Box::new(move |_editor: &mut Editor, compositor: &mut Compositor| {
717− let log_message = breakpoint.log_message;
718− let prompt = Prompt::new(
717+ let mut prompt = Prompt::new(
719− "log message: ".into(),
718+ "log-message:".into(),
720 None,
719 None,
721 |_input: &str| Vec::new(),
720 |_input: &str| Vec::new(),
722 move |cx: &mut crate::compositor::Context,
721 move |cx: &mut crate::compositor::Context,
@@ -775,8 +774,10 @@ pub fn dap_edit_log(cx: &mut Context) {
775 }
774 }
776 }
775 }
777 },
776 },
778− log_message,
779 );
777 );
778+ if let Some(log_message) = breakpoint.log_message {
779+ prompt.insert_str(&log_message);
780+ }
780 compositor.push(Box::new(prompt));
781 compositor.push(Box::new(prompt));
781 });
782 });
782 Ok(call)
783 Ok(call)
helix-term/src/ui/mod.rs−1
@@ -90,7 +90,6 @@ pub fn regex_prompt(
90 }
90 }
91 }
91 }
92 },
92 },
93− None,
94 )
93 )
95}
94}
96
95
helix-term/src/ui/picker.rs−1
@@ -301,7 +301,6 @@ impl<T> Picker<T> {
301 |_editor: &mut Context, _pattern: &str, _event: PromptEvent| {
301 |_editor: &mut Context, _pattern: &str, _event: PromptEvent| {
302 //
302 //
303 },
303 },
304− None,
305 );
304 );
306
305
307 let mut picker = Self {
306 let mut picker = Self {
helix-term/src/ui/prompt.rs+1−2
@@ -61,11 +61,10 @@ impl Prompt {
61 history_register: Option<char>,
61 history_register: Option<char>,
62 mut completion_fn: impl FnMut(&str) -> Vec<Completion> + 'static,
62 mut completion_fn: impl FnMut(&str) -> Vec<Completion> + 'static,
63 callback_fn: impl FnMut(&mut Context, &str, PromptEvent) + 'static,
63 callback_fn: impl FnMut(&mut Context, &str, PromptEvent) + 'static,
64− line: Option<String>,
65 ) -> Self {
64 ) -> Self {
66 Self {
65 Self {
67 prompt,
66 prompt,
68− line: line.unwrap_or_default(),
67+ line: String::new(),
69 cursor: 0,
68 cursor: 0,
70 completion: completion_fn(""),
69 completion: completion_fn(""),
71 selection: None,
70 selection: None,