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

Global search now indicates currently open document #803

Merged
merged 3 commits into from
Oct 8, 2021

Conversation

freiguy1
Copy link
Contributor

@freiguy1 freiguy1 commented Oct 3, 2021

So I guess I also implemented the global search relative file paths slightly after someone else. I decided to add the (*) like the buffer picker indicates the currently open document.

image

@pickfire
Copy link
Contributor

pickfire commented Oct 3, 2021

Thanks for contributing to helix. Looks like a good feature to have but I think (*) might be a bit long.

@freiguy1
Copy link
Contributor Author

freiguy1 commented Oct 3, 2021

Hi! I chose (*) because that's what the buffer picker uses. Here's an example of the buffer picker? Should I change them both to just *? Thanks!

@archseer
Copy link
Member

archseer commented Oct 4, 2021

Please keep them as is, but can you rebase on top of master? There was a lint failure that has been addressed.

@freiguy1
Copy link
Contributor Author

freiguy1 commented Oct 4, 2021

Whoops - I didn't attach a pic of the buffer picker:
image

I've merged upstream/master and pushed those! Thanks for the info.

@@ -1291,7 +1291,8 @@ fn global_search(cx: &mut Context) {

cx.push_layer(Box::new(prompt));

let root = find_root(None).unwrap_or_else(|| PathBuf::from("./"));
let current_path = doc_mut!(cx.editor).path().cloned();
Copy link
Member

Choose a reason for hiding this comment

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

Actually, this keeps the path relative to the working directory whereas other pickers use the project root. Can we keep the original behavior? Either that or other code paths should be updated to align the behaviors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, I'm not sure I understand. That current_path variable is just used to compare against the list of search results for when to put in the asterisk. It doesn't change where the path is relative to.

I'm not sure what you mean by working directory vs project root. I attempted to use the same logic which the buffer_picker used when formatting relative path: helix_core::path::get_relative_path(path)

Copy link
Member

Choose a reason for hiding this comment

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

Looks like buffer_picker and file_picker don't use the same logic. I'll fix it in a follow-up.

@archseer archseer merged commit 9f27be4 into helix-editor:master Oct 8, 2021
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.

None yet

3 participants