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) {
|
||||
let now = Instant::now();
|
||||
|
||||
let pattern = &self.prompt.line;
|
||||
let pattern = self.prompt.line();
|
||||
|
||||
if pattern == &self.previous_pattern {
|
||||
return;
|
||||
|
@ -607,7 +607,7 @@ impl<T: 'static> Component for Picker<T> {
|
|||
|
||||
let (_score, highlights) = self
|
||||
.matcher
|
||||
.fuzzy_indices(&formatted, &self.prompt.line)
|
||||
.fuzzy_indices(&formatted, self.prompt.line())
|
||||
.unwrap_or_default();
|
||||
|
||||
surface.set_string_truncated(
|
||||
|
|
|
@ -19,7 +19,7 @@ pub type Completion = (RangeFrom<usize>, Cow<'static, str>);
|
|||
|
||||
pub struct Prompt {
|
||||
prompt: Cow<'static, str>,
|
||||
pub line: String,
|
||||
line: String,
|
||||
cursor: usize,
|
||||
completion: Vec<Completion>,
|
||||
selection: Option<usize>,
|
||||
|
@ -77,6 +77,10 @@ impl Prompt {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn line(&self) -> &String {
|
||||
&self.line
|
||||
}
|
||||
|
||||
pub fn recalculate_completion(&mut self, editor: &Editor) {
|
||||
self.completion = (self.completion_fn)(editor, &self.line);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue