DiffViewer: prose files (Markdown, plain text) read plain, not as code
This commit is contained in:
2 files changed
+45
-6
No files matched your search
+6
-3
@@ -9,7 +9,7 @@ use gpui::{
|
||||
use super::{
|
||||
badges::DiffStat,
|
||||
diff::{DiffLine, LineKind, Stretch, diff, side_numbers},
|
||||
rows::{Place, Shown, code, shown, spoken, washes},
|
||||
rows::{Place, Shown, code, prose, shown, spoken, washes},
|
||||
};
|
||||
use crate::{
|
||||
buttons::{Button, ButtonVariant, SegmentedControl},
|
||||
@@ -194,6 +194,7 @@ impl RenderOnce for DiffViewer {
|
||||
.len()
|
||||
.max(2);
|
||||
let (id, on_open) = (self.id.clone(), self.on_open.clone());
|
||||
let prose = prose(&self.path);
|
||||
let (button, button_height) = (
|
||||
self.hunk_action.is_some(),
|
||||
theme.control_height(ControlSize::Sm),
|
||||
@@ -269,7 +270,9 @@ impl RenderOnce for DiffViewer {
|
||||
.when_some(wash, |side, wash| side.bg(wash))
|
||||
.child(number(shown))
|
||||
.children(line.map(|(_, line)| {
|
||||
div().whitespace_nowrap().child(code(line, &colors, cx))
|
||||
div()
|
||||
.whitespace_nowrap()
|
||||
.child(code(line, &colors, prose, cx))
|
||||
}));
|
||||
match line {
|
||||
Some((place, line)) => {
|
||||
@@ -328,7 +331,7 @@ impl RenderOnce for DiffViewer {
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.overflow_hidden()
|
||||
.child(code(line, &colors, cx)),
|
||||
.child(code(line, &colors, prose, cx)),
|
||||
)
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user