git_ui: Preserve line breaks in commit message view (#66608)

The commit view renders the commit message as Markdown using the hover
style, which treats single newlines as soft breaks. Hard-wrapped commit
bodies were therefore reflowed into a single paragraph.

This sets `soft_break_as_hard_break: true` on the commit view's
`MarkdownStyle`, so messages keep their original line breaks.

<img width="3786" height="470" alt="Screenshot From 2026-11-06 10-23-54"
src="https://github.com/user-attachments/assets/7ac99615-6999-4b6b-a0fc-81391b630bff"
/>

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed commit messages losing their line breaks in the commit view
This commit is contained in:
Michal Matczuk
2026-11-06 11:02:28 +00:00
committed by GitHub
parent 1478fb5e60
commit e40e600719
+5 -2
View File
@@ -22,7 +22,7 @@ use language::{
Buffer, Capability, DiskState, File, LanguageRegistry, LineEnding, OffsetRangeExt as _,
ReplicaId, Rope, TextBuffer,
};
use markdown::{Markdown, MarkdownElement};
use markdown::{Markdown, MarkdownElement, MarkdownStyle};
use multi_buffer::PathKey;
use project::{
Project, ProjectPath, WorktreeId,
@@ -878,7 +878,10 @@ impl CommitView {
return None;
}
let markdown_style = hover_markdown_style(window, cx);
let markdown_style = MarkdownStyle {
soft_break_as_hard_break: true,
..hover_markdown_style(window, cx)
};
let is_expanded = self.message_expanded;