-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Selection-constrained search/replace #8617
Comments
Not sure if there is anything salvagable this long after the fact, but an older employee had begun work on this here: Might be useful to someone else wanting to work on this. Adding the |
Hi! I'd like to try implementing this feature if @zambetti hasn't started work on it yet (: |
Currently, when multiple lines are selected, only the first one is auto-filled, so what about only using auto-fill when the selection doesn't span over more than 1 line? |
@hferreiro: I just tried this. if you select multiple lines, and open Buffer Search via cmd-F, the auto-filled search field looks like it only has one line, but the remaining lines and horizontally-clipped text can be seen via two-finger scroll&pan (I'm using Zed Preview 0.125.0). Your comment makes me think that the search field (and replace field) in Buffer Search being only a single line high is perhaps a place for possible UI improvement. When containing multiline content, the fields (and panel) could grow in height to show two lines, indicating that there is more to see and that the panel is growable. That with the ability to click&drag the border of the Buffer Search pane downward to reveal more lines in both the search and replace fields would make it friendlier for multiline work. This kind of UI improvement is likely beyond the scope of this ticket though.
Hi @timcki, it's great that you're up for taking a shot at this with the talented Zed team. I hope to one day have the chops to be a contributor, still in the process of learning Rust. |
Hey, can i try to implement this feature (specifically fetaure 2)?. I have gone through the linked PR , and some of the code of the Search functionality. I am gonna try to explain what I understood from the code, any guidance on my understanding or documentation about it would be helpful. crates/search/src/search.rs - This contains the searchOptions struct which is needed for SearchQuery struct which is in (crates/project/src/search.rs) The Changes in search.rs are just adding a field named ToggleSelection and defining the icon etc,etc. I have added Some screenshots. The first file is just the search.rs in project crate This screenshot is of project search in search crate, i dont think i will have to modify this ? (This is just to match paths ?? ) and for the last file, buffer_search in search crate, this is where i need to understand the flow the most. Buffer Search has an active query field , which calls find_matches on it and i cant seem to understand the flow from there. :( I am sorry for tagging you but any help would be greatly appreciated @JosephTLyons . Thanks in advance. And sorry for any rude behaviour and for such a large comment |
@hshreekar I just started working on this issue, do you want to collaborate on it together? |
Sure @Anthony-Eid. Would love to colloborate with you on this issue |
I'm available this week or next week to collaborate on it with you. On you on the discord? We could figure out a time for us to hope on a call together there. |
Check for existing issues
Describe the feature
It seems that, as it is now, Zed can only perform search/replace on an entire document, and there is no way to constrain search/replace to only the selected text.
When you click the magnifying glass while text is selected, it assumes that you are searching for the selected text. This assumption might speed up some scenarios, but it necessitates that all searching is to be done for the entire document. This limits the value of "replace all".
Link to discussion on this topic.
If applicable, add mockups / screenshots to help present your vision of the feature
A proposed modification to the existing search/replace function is:
Remove auto-fill of selected text in search field when opening "Buffer Search" via clicking on magnifying glass or via cmd-E. Auto-fill of search field would still happen as it does today with cmd-F.
Add toggle button for "Selected text only" to the "Buffer Search" UI
The text was updated successfully, but these errors were encountered: