Make line a private property
This commit is contained in:
parent
96a4eb8483
commit
92bb312f0f
2 changed files with 7 additions and 3 deletions
|
@ -339,7 +339,7 @@ impl<T> Picker<T> {
|
||||||
pub fn score(&mut self) {
|
pub fn score(&mut self) {
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
|
|
||||||
let pattern = &self.prompt.line;
|
let pattern = self.prompt.line();
|
||||||
|
|
||||||
if pattern == &self.previous_pattern {
|
if pattern == &self.previous_pattern {
|
||||||
return;
|
return;
|
||||||
|
@ -607,7 +607,7 @@ impl<T: 'static> Component for Picker<T> {
|
||||||
|
|
||||||
let (_score, highlights) = self
|
let (_score, highlights) = self
|
||||||
.matcher
|
.matcher
|
||||||
.fuzzy_indices(&formatted, &self.prompt.line)
|
.fuzzy_indices(&formatted, self.prompt.line())
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
surface.set_string_truncated(
|
surface.set_string_truncated(
|
||||||
|
|
|
@ -19,7 +19,7 @@ pub type Completion = (RangeFrom<usize>, Cow<'static, str>);
|
||||||
|
|
||||||
pub struct Prompt {
|
pub struct Prompt {
|
||||||
prompt: Cow<'static, str>,
|
prompt: Cow<'static, str>,
|
||||||
pub line: String,
|
line: String,
|
||||||
cursor: usize,
|
cursor: usize,
|
||||||
completion: Vec<Completion>,
|
completion: Vec<Completion>,
|
||||||
selection: Option<usize>,
|
selection: Option<usize>,
|
||||||
|
@ -77,6 +77,10 @@ impl Prompt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn line(&self) -> &String {
|
||||||
|
&self.line
|
||||||
|
}
|
||||||
|
|
||||||
pub fn recalculate_completion(&mut self, editor: &Editor) {
|
pub fn recalculate_completion(&mut self, editor: &Editor) {
|
||||||
self.completion = (self.completion_fn)(editor, &self.line);
|
self.completion = (self.completion_fn)(editor, &self.line);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue