Coalesce consecutive spaces in new buffer tab titles (#32363)
VS Code has a behavior where it coalesces consecutive spaces in new buffer tab titles, which I quite like. This presents the content better and allows more meaningful content to be displayed, as consecutive spaces don't count towards the 40 character limit. VS Code <img width="1013" alt="SCR-20250608-uelt" src="https://github.com/user-attachments/assets/71a1fd4b-a506-4eab-b6a4-66096a12f1ad" /> Zed <img width="1136" alt="SCR-20250608-ueif" src="https://github.com/user-attachments/assets/f40fc3c9-0f0f-471d-93ed-be9568fbe778" /> Release Notes: - N/A
This commit is contained in:
parent
4fe05530b0
commit
ebea734515
3 changed files with 63 additions and 22 deletions
|
@ -3686,10 +3686,20 @@ fn test_new_empty_buffer_takes_trimmed_first_line_for_title(cx: &mut App) {
|
|||
|
||||
#[gpui::test]
|
||||
fn test_new_empty_buffer_uses_truncated_first_line_for_title(cx: &mut App) {
|
||||
let title_after = ["a", "b", "c", "d"]
|
||||
.map(|letter| letter.repeat(10))
|
||||
.join("");
|
||||
let title = format!("{}{}", title_after, "e".repeat(10));
|
||||
let title = "aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeee";
|
||||
let title_after = "aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd";
|
||||
let buffer = cx.new(|cx| Buffer::local(title, cx));
|
||||
let multibuffer = cx.new(|cx| MultiBuffer::singleton(buffer.clone(), cx));
|
||||
|
||||
assert_eq!(multibuffer.read(cx).title(cx), title_after);
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn test_new_empty_buffer_uses_truncated_first_line_for_title_after_merging_adjacent_spaces(
|
||||
cx: &mut App,
|
||||
) {
|
||||
let title = "aaaaaaaaaabbbbbbbbbb ccccccccccddddddddddeeeeeeeeee";
|
||||
let title_after = "aaaaaaaaaabbbbbbbbbb ccccccccccddddddddd";
|
||||
let buffer = cx.new(|cx| Buffer::local(title, cx));
|
||||
let multibuffer = cx.new(|cx| MultiBuffer::singleton(buffer.clone(), cx));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue