Replace newlines in search bar (#33504)

Release Notes:

- search: Pasted newlines are now rendered as "\n" (with an underline),
instead of line-wrapping. This should make it much clearer what you're
searching for.
 
<img width="675" alt="Screenshot 2025-06-27 at 00 34 52"
src="https://github.com/user-attachments/assets/67275bc6-bec1-463f-b351-6b9ed0a6df81"
/>
This commit is contained in:
Conrad Irwin 2025-06-27 09:39:38 -06:00 committed by GitHub
parent d74f3f4ea6
commit 157199b65b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 92 additions and 10 deletions

View file

@ -22770,6 +22770,24 @@ async fn test_mtime_and_document_colors(cx: &mut TestAppContext) {
});
}
#[gpui::test]
async fn test_newline_replacement_in_single_line(cx: &mut TestAppContext) {
init_test(cx, |_| {});
let (editor, cx) = cx.add_window_view(Editor::single_line);
editor.update_in(cx, |editor, window, cx| {
editor.set_text("oops\n\nwow\n", window, cx)
});
cx.run_until_parked();
editor.update(cx, |editor, cx| {
assert_eq!(editor.display_text(cx), "oops⋯⋯wow⋯");
});
editor.update(cx, |editor, cx| editor.edit([(3..5, "")], cx));
cx.run_until_parked();
editor.update(cx, |editor, cx| {
assert_eq!(editor.display_text(cx), "oop⋯wow⋯");
});
}
#[track_caller]
fn extract_color_inlays(editor: &Editor, cx: &App) -> Vec<Rgba> {
editor