Multiline input in buffer search input only shows last line
Summary
The issue concerns the search and replace panel in Zed - when a user employs a replacement string containing line breaks (multiline), it is not fully visible in the interface (only the last line is visible), which consequently leads to unexpected results for the user.
The replacement present in the video below is as follows:
accidentally copied string # not visible
Morem # only thing visible
https://github.com/user-attachments/assets/30ad63f8-3534-464a-9d36-9f6e9ac4d875
Description
Steps to reproduce:
- Copy Search and Replace
- Write string for replacement in top input
- Paste multiline string in second input
Expected Behavior:
Input show that it have more that one string
Zed Version and System Specs
Zed 0.181.5 4f04f932c1e6a296acde3f93e078d23f1e6e44ca
Hey thanks for reporting, this behavior is definitely pretty awful. Out of curiosity, would you prefer that multiline input in this context show up as a \n-delimited string like accidentally copied string\nMorem or would you prefer the input box scaled with the input to show it at all times? Or something else entirely.
This feature was clearly designed without multiline input in mind, so wondering what your thoughts are on how this could be improved
@probably-neb is a good question. On one hand, multiline format appears more reader-friendly and covers most use cases (for example, vscode displays the first 6 lines, then a scroll bar appears). On the other hand, in regular expressions we sometimes need \n and occasionally \r\n (CRLF). (In vscode's regular expression mode, you can use \n alongside a normal line break entered via ctrl+enter) Personally, I don't have a strong preference, and I would be completely satisfied if all line breaks added in the search field were converted to \n or \r\n. If they were somehow visually indicated (for example, with a semi-transparent color), it wouldn't even affect readability.
Ok, thanks for the input!
I would say that it should always be an actual line break. For regular expressions, you're using the literal characters \n, which is not the same thing.
Hi there! 👋 We're working to clean up our issue tracker by closing older bugs that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and it will be kept open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, it will close automatically in 14 days. Thanks for your help!
Zed still adds /n instead of a real newline
@ItsHarper thanks for confirming! we'll try to look into it during the upcoming Quality Week.