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:
Joseph T. Lyons 2025-06-09 02:01:32 -04:00 committed by GitHub
parent 4fe05530b0
commit ebea734515
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 63 additions and 22 deletions

View file

@ -18858,7 +18858,7 @@ impl Editor {
cx.emit(EditorEvent::BufferEdited);
cx.emit(SearchEvent::MatchesInvalidated);
if *singleton_buffer_edited {
if let Some(buffer) = multibuffer.read(cx).as_singleton() {
if let Some(buffer) = edited_buffer {
if buffer.read(cx).file().is_none() {
cx.emit(EditorEvent::TitleChanged);
}