From 80f21d37e065966990dd920b8dca6eaaec7c76d3 Mon Sep 17 00:00:00 2001 From: sholderbach Date: Mon, 4 Apr 2022 23:35:31 +0200 Subject: [PATCH] Update reedline to mut Completer API --- Cargo.lock | 2 +- crates/nu-cli/src/completions.rs | 2 +- crates/nu-cli/src/menus/description_menu.rs | 6 +++--- crates/nu-cli/src/menus/help_completions.rs | 2 +- crates/nu-cli/src/menus/menu_completions.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 12e3b31b2c..e333a6631f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3536,7 +3536,7 @@ dependencies = [ [[package]] name = "reedline" version = "0.3.1" -source = "git+https://github.com/nushell/reedline?branch=main#698190c534e8632f76561cbe8b45a5de74a6e96f" +source = "git+https://github.com/nushell/reedline?branch=main#63327477305f623f7258b3416e2702af57e25c0f" dependencies = [ "chrono", "crossterm", diff --git a/crates/nu-cli/src/completions.rs b/crates/nu-cli/src/completions.rs index c8777d93df..23b33e1137 100644 --- a/crates/nu-cli/src/completions.rs +++ b/crates/nu-cli/src/completions.rs @@ -625,7 +625,7 @@ impl NuCompleter { } impl Completer for NuCompleter { - fn complete(&self, line: &str, pos: usize) -> Vec { + fn complete(&mut self, line: &str, pos: usize) -> Vec { self.completion_helper(line, pos) } } diff --git a/crates/nu-cli/src/menus/description_menu.rs b/crates/nu-cli/src/menus/description_menu.rs index 69da0fac8c..c90ace0e00 100644 --- a/crates/nu-cli/src/menus/description_menu.rs +++ b/crates/nu-cli/src/menus/description_menu.rs @@ -460,7 +460,7 @@ impl Menu for DescriptionMenu { &mut self, _values_updated: bool, _line_buffer: &mut LineBuffer, - _completer: &dyn Completer, + _completer: &mut dyn Completer, ) -> bool { false } @@ -481,7 +481,7 @@ impl Menu for DescriptionMenu { } /// Updates menu values - fn update_values(&mut self, line_buffer: &mut LineBuffer, completer: &dyn Completer) { + fn update_values(&mut self, line_buffer: &mut LineBuffer, completer: &mut dyn Completer) { if self.only_buffer_difference { if let Some(old_string) = &self.input { let (start, input) = string_difference(line_buffer.get_buffer(), old_string); @@ -503,7 +503,7 @@ impl Menu for DescriptionMenu { fn update_working_details( &mut self, line_buffer: &mut LineBuffer, - completer: &dyn Completer, + completer: &mut dyn Completer, painter: &Painter, ) { if let Some(event) = self.event.take() { diff --git a/crates/nu-cli/src/menus/help_completions.rs b/crates/nu-cli/src/menus/help_completions.rs index bd7029f0d6..0c7e021b76 100644 --- a/crates/nu-cli/src/menus/help_completions.rs +++ b/crates/nu-cli/src/menus/help_completions.rs @@ -98,7 +98,7 @@ impl NuHelpCompleter { } impl Completer for NuHelpCompleter { - fn complete(&self, line: &str, pos: usize) -> Vec { + fn complete(&mut self, line: &str, pos: usize) -> Vec { self.completion_helper(line, pos) } } diff --git a/crates/nu-cli/src/menus/menu_completions.rs b/crates/nu-cli/src/menus/menu_completions.rs index 394590a1e6..1631fad688 100644 --- a/crates/nu-cli/src/menus/menu_completions.rs +++ b/crates/nu-cli/src/menus/menu_completions.rs @@ -34,7 +34,7 @@ impl NuMenuCompleter { } impl Completer for NuMenuCompleter { - fn complete(&self, line: &str, pos: usize) -> Vec { + fn complete(&mut self, line: &str, pos: usize) -> Vec { let parsed = parse_selection_char(line, SELECTION_CHAR); let block = self.engine_state.get_block(self.block_id);