Allow search/replace to span multiple lines#50783
Allow search/replace to span multiple lines#50783nathansobo merged 5 commits intozed-industries:mainfrom
Conversation
adds start_of_input, and allows both {start,end}_of_input to work in either single or auto height editor modes
|
What do keybinds look like, now that the search bars are multi-line? Does enter still submit the search like before? #50420 was just added to the macOS default keymap to support typing newlines with ctrl-enter. |
By default in this - up and down still moves between history items, enter and shift+enter moves to the next and previous result, respectively, and ctrl+enter for newlines. |
VS Code handles this by letting the up/down arrow keys manipulate the cursor, but if the cursor is on the first line and you press up arrow (or if the cursor is on the last line and you press down arrow), then it moves to the adjacent history item. Worth considering here. |
Does the ctrl-enter keybind from the |
right! if it wasn't clear in my response, it does this by checking explicitly whether you are at the beginning of the first line or the end of the search input - I also tried to show this in the video but since there's no key inputs shown it's all kind of a mess.
It does. If my comment here is addressed and this PR stays, I'll modify accordingly :) |
…arch Stop clearing the search query when pressing down arrow past the last history entry. Instead, preserve the current text. In project search, save unsubmitted text as a draft before navigating history, and restore it when reaching the end. In multi-line search editors, let up/down arrows move the cursor normally within the text. Only navigate history when the content is a single line or the cursor is at the input boundary.
After setting the search editor text during history navigation, request autoscroll so the cursor is visible even when the content exceeds the editor's max visible height.
|
Thanks for working on this, @claiwe! Multi-line search is a great addition. @gaauwe and I tested it out and pushed a couple of follow-up commits addressing some edge cases we ran into: Fix search history navigation and arrow key behavior (
Scroll cursor into view for long history entries (
|
Closes zed-industries#49957 Also adds `start_of_input` context, and modifies both `{start,end}_of_input` to work for both single line and auto height editor modes. https://github.com/user-attachments/assets/e30f2b20-a96c-49d5-9eb6-3c95a485d14a Before you mark this PR as ready for review, make sure that you have: - [x] Added a solid test coverage and/or screenshots from doing manual testing - [x] Done a self-review taking into account security and performance aspects - [x] Aligned any UI changes with the [UI checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) Release Notes: - Added support for multi-line search and replace input in Buffer Search and Project Search --------- Co-authored-by: Nathan Sobo <nathan@zed.dev>
Closes zed-industries#49957 Also adds `start_of_input` context, and modifies both `{start,end}_of_input` to work for both single line and auto height editor modes. https://github.com/user-attachments/assets/e30f2b20-a96c-49d5-9eb6-3c95a485d14a Before you mark this PR as ready for review, make sure that you have: - [x] Added a solid test coverage and/or screenshots from doing manual testing - [x] Done a self-review taking into account security and performance aspects - [x] Aligned any UI changes with the [UI checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) Release Notes: - Added support for multi-line search and replace input in Buffer Search and Project Search --------- Co-authored-by: Nathan Sobo <nathan@zed.dev>
Closes zed-industries#49957 Also adds `start_of_input` context, and modifies both `{start,end}_of_input` to work for both single line and auto height editor modes. https://github.com/user-attachments/assets/e30f2b20-a96c-49d5-9eb6-3c95a485d14a Before you mark this PR as ready for review, make sure that you have: - [x] Added a solid test coverage and/or screenshots from doing manual testing - [x] Done a self-review taking into account security and performance aspects - [x] Aligned any UI changes with the [UI checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) Release Notes: - Added support for multi-line search and replace input in Buffer Search and Project Search --------- Co-authored-by: Nathan Sobo <nathan@zed.dev>

Closes #49957
Also adds
start_of_inputcontext, and modifies both{start,end}_of_inputto work for both single line and auto height editor modes.Screen.Recording.2026-03-04.at.23.09.03.mov
Before you mark this PR as ready for review, make sure that you have:
Release Notes: