Update reedline to mut Completer API

This commit is contained in:
sholderbach 2022-04-04 23:35:31 +02:00
parent e2cf4cc7d6
commit 80f21d37e0
No known key found for this signature in database
GPG key ID: CC0EAB05E891A2F4
5 changed files with 7 additions and 7 deletions

2
Cargo.lock generated
View file

@ -3536,7 +3536,7 @@ dependencies = [
[[package]] [[package]]
name = "reedline" name = "reedline"
version = "0.3.1" 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 = [ dependencies = [
"chrono", "chrono",
"crossterm", "crossterm",

View file

@ -625,7 +625,7 @@ impl NuCompleter {
} }
impl Completer for NuCompleter { impl Completer for NuCompleter {
fn complete(&self, line: &str, pos: usize) -> Vec<Suggestion> { fn complete(&mut self, line: &str, pos: usize) -> Vec<Suggestion> {
self.completion_helper(line, pos) self.completion_helper(line, pos)
} }
} }

View file

@ -460,7 +460,7 @@ impl Menu for DescriptionMenu {
&mut self, &mut self,
_values_updated: bool, _values_updated: bool,
_line_buffer: &mut LineBuffer, _line_buffer: &mut LineBuffer,
_completer: &dyn Completer, _completer: &mut dyn Completer,
) -> bool { ) -> bool {
false false
} }
@ -481,7 +481,7 @@ impl Menu for DescriptionMenu {
} }
/// Updates menu values /// 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 self.only_buffer_difference {
if let Some(old_string) = &self.input { if let Some(old_string) = &self.input {
let (start, input) = string_difference(line_buffer.get_buffer(), old_string); let (start, input) = string_difference(line_buffer.get_buffer(), old_string);
@ -503,7 +503,7 @@ impl Menu for DescriptionMenu {
fn update_working_details( fn update_working_details(
&mut self, &mut self,
line_buffer: &mut LineBuffer, line_buffer: &mut LineBuffer,
completer: &dyn Completer, completer: &mut dyn Completer,
painter: &Painter, painter: &Painter,
) { ) {
if let Some(event) = self.event.take() { if let Some(event) = self.event.take() {

View file

@ -98,7 +98,7 @@ impl NuHelpCompleter {
} }
impl Completer for NuHelpCompleter { impl Completer for NuHelpCompleter {
fn complete(&self, line: &str, pos: usize) -> Vec<Suggestion> { fn complete(&mut self, line: &str, pos: usize) -> Vec<Suggestion> {
self.completion_helper(line, pos) self.completion_helper(line, pos)
} }
} }

View file

@ -34,7 +34,7 @@ impl NuMenuCompleter {
} }
impl Completer for NuMenuCompleter { impl Completer for NuMenuCompleter {
fn complete(&self, line: &str, pos: usize) -> Vec<Suggestion> { fn complete(&mut self, line: &str, pos: usize) -> Vec<Suggestion> {
let parsed = parse_selection_char(line, SELECTION_CHAR); let parsed = parse_selection_char(line, SELECTION_CHAR);
let block = self.engine_state.get_block(self.block_id); let block = self.engine_state.get_block(self.block_id);