Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trim leading whitespaces in file search #2585

Closed
wants to merge 1 commit into from

Conversation

Xenelio
Copy link

@Xenelio Xenelio commented May 27, 2022

fix #2564

@the-mikedavis the-mikedavis added the S-waiting-on-review Status: Awaiting review from a maintainer. label May 27, 2022
@archseer
Copy link
Member

This doesn't affect just file search though, but anything using the picker. Using space at the start of a search query can also be intentional: it's fuzzy search so it could just indicate some text needs to be preceded by a space.

@the-mikedavis the-mikedavis removed the S-waiting-on-review Status: Awaiting review from a maintainer. label May 29, 2022
@@ -349,7 +349,7 @@ impl<T> Picker<T> {
pub fn score(&mut self) {
let now = Instant::now();

let pattern = self.prompt.line();
let pattern = &self.prompt.line().trim_start().to_string();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The to_string() allocation is only necessary for line 422, which does another clone. I would remove here the &...to_string() and put in 422 self.previous_pattern = pattern.to_string();

@archseer
Copy link
Member

archseer commented Jun 5, 2022

Closing since this is intentional behaviour

@archseer archseer closed this Jun 5, 2022
@Xenelio Xenelio deleted the trim-search branch June 5, 2022 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trim leading space in file picker search
4 participants