on master help sign in
dap: Remove the prompt line parameter, use insert_str instead
commit0eadeab8c7c3f1ddc794661782ebbe19ddf5311e authorBlaž Hrastnik <blaz@mxxn.io> dateMon 22 Nov 2021, 11:13 (5 years ago) parent5f329a2
5 files changed+11−17
helix-term/src/commands.rs−4 helix-term/src/commands/dap.rs+10−9 helix-term/src/ui/mod.rs−1 helix-term/src/ui/picker.rs−1 helix-term/src/ui/prompt.rs+1−2
helix-term/src/commands.rs−4
@@ -2839,7 +2839,6 @@ fn command_mode(cx: &mut Context) {
28392839 .set_error(format!("no such command: '{}'", parts[0]));
28402840 };
28412841 },
2842− None,
28432842 );
28442843 prompt.doc_fn = Box::new(|input: &str| {
28452844 let part = input.split(' ').next().unwrap_or_default();
@@ -5440,7 +5439,6 @@ fn shell_keep_pipe(cx: &mut Context) {
54405439 let index = index.unwrap_or_else(|| ranges.len() - 1);
54415440 doc.set_selection(view.id, Selection::new(ranges, index));
54425441 },
5443− None,
54445442 );
54455443
54465444 cx.push_layer(Box::new(prompt));
@@ -5544,7 +5542,6 @@ fn shell(cx: &mut Context, prompt: Cow<'static, str>, behavior: ShellBehavior) {
55445542 // make sure cursor is in view and update scroll as well
55455543 view.ensure_cursor_in_view(doc, cx.editor.config.scrolloff);
55465544 },
5547− None,
55485545 );
55495546
55505547 cx.push_layer(Box::new(prompt));
@@ -5622,7 +5619,6 @@ fn rename_symbol(cx: &mut Context) {
56225619 log::debug!("Edits from LSP: {:?}", edits);
56235620 apply_workspace_edit(&mut cx.editor, offset_encoding, &edits);
56245621 },
5625− None,
56265622 );
56275623 cx.push_layer(Box::new(prompt));
56285624}
helix-term/src/commands/dap.rs+10−9
@@ -386,7 +386,6 @@ fn debug_parameter_prompt(
386386 );
387387 }
388388 },
389− None,
390389 )
391390}
392391
@@ -638,9 +637,8 @@ pub fn dap_edit_condition(cx: &mut Context) {
638637 let callback = Box::pin(async move {
639638 let call: Callback =
640639 Box::new(move |_editor: &mut Editor, compositor: &mut Compositor| {
641− let condition = breakpoint.condition;
642− let prompt = Prompt::new(
643− "condition: ".into(),
640+ let mut prompt = Prompt::new(
641+ "condition:".into(),
644642 None,
645643 |_input: &str| Vec::new(),
646644 move |cx: &mut crate::compositor::Context,
@@ -699,8 +697,10 @@ pub fn dap_edit_condition(cx: &mut Context) {
699697 }
700698 }
701699 },
702− condition,
703700 );
701+ if let Some(condition) = breakpoint.condition {
702+ prompt.insert_str(&condition)
703+ }
704704 compositor.push(Box::new(prompt));
705705 });
706706 Ok(call)
@@ -714,9 +714,8 @@ pub fn dap_edit_log(cx: &mut Context) {
714714 let callback = Box::pin(async move {
715715 let call: Callback =
716716 Box::new(move |_editor: &mut Editor, compositor: &mut Compositor| {
717− let log_message = breakpoint.log_message;
718− let prompt = Prompt::new(
719− "log message: ".into(),
717+ let mut prompt = Prompt::new(
718+ "log-message:".into(),
720719 None,
721720 |_input: &str| Vec::new(),
722721 move |cx: &mut crate::compositor::Context,
@@ -775,8 +774,10 @@ pub fn dap_edit_log(cx: &mut Context) {
775774 }
776775 }
777776 },
778− log_message,
779777 );
778+ if let Some(log_message) = breakpoint.log_message {
779+ prompt.insert_str(&log_message);
780+ }
780781 compositor.push(Box::new(prompt));
781782 });
782783 Ok(call)
helix-term/src/ui/mod.rs−1
@@ -90,7 +90,6 @@ pub fn regex_prompt(
9090 }
9191 }
9292 },
93− None,
9493 )
9594}
9695
helix-term/src/ui/picker.rs−1
@@ -301,7 +301,6 @@ impl<T> Picker<T> {
301301 |_editor: &mut Context, _pattern: &str, _event: PromptEvent| {
302302 //
303303 },
304− None,
305304 );
306305
307306 let mut picker = Self {
helix-term/src/ui/prompt.rs+1−2
@@ -61,11 +61,10 @@ impl Prompt {
6161 history_register: Option<char>,
6262 mut completion_fn: impl FnMut(&str) -> Vec<Completion> + 'static,
6363 callback_fn: impl FnMut(&mut Context, &str, PromptEvent) + 'static,
64− line: Option<String>,
6564 ) -> Self {
6665 Self {
6766 prompt,
68− line: line.unwrap_or_default(),
67+ line: String::new(),
6968 cursor: 0,
7069 completion: completion_fn(""),
7170 selection: None,