zed icon indicating copy to clipboard operation
zed copied to clipboard

Multiline input in buffer search input only shows last line

Open Akiyamka opened this issue 10 months ago • 3 comments

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:

  1. Copy Search and Replace
  2. Write string for replacement in top input
  3. Paste multiline string in second input

Expected Behavior: Input show that it have more that one string Image

Zed Version and System Specs

Zed 0.181.5 4f04f932c1e6a296acde3f93e078d23f1e6e44ca

Akiyamka avatar Apr 11 '25 11:04 Akiyamka

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 avatar Apr 22 '25 14:04 probably-neb

@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.

Akiyamka avatar Apr 28 '25 11:04 Akiyamka

Ok, thanks for the input!

probably-neb avatar Apr 28 '25 14:04 probably-neb

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.

ItsHarper avatar Jul 04 '25 16:07 ItsHarper

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!

github-actions[bot] avatar Nov 19 '25 09:11 github-actions[bot]

Zed still adds /n instead of a real newline

ItsHarper avatar Nov 19 '25 15:11 ItsHarper

@ItsHarper thanks for confirming! we'll try to look into it during the upcoming Quality Week.

zelenenka avatar Nov 19 '25 15:11 zelenenka