aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/markdown.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-11-30 04:06:30 +0000
committerBlaž Hrastnik2021-11-30 04:06:30 +0000
commit9ed930b2335b86d03e871b52a958d4e9768e0d34 (patch)
tree91add4e3dbc128752a47f30b4a2bd093b6118632 /helix-term/src/ui/markdown.rs
parent72576822f31ee2e2f88a1b627b0f5c14dc66ec37 (diff)
parent94296229e72cb9a56fb36d9cc3bc2513df3c54f6 (diff)
Merge remote-tracking branch 'origin/master' into debug
Diffstat (limited to 'helix-term/src/ui/markdown.rs')
-rw-r--r--helix-term/src/ui/markdown.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/helix-term/src/ui/markdown.rs b/helix-term/src/ui/markdown.rs
index 61630d55..ca8303dd 100644
--- a/helix-term/src/ui/markdown.rs
+++ b/helix-term/src/ui/markdown.rs
@@ -55,7 +55,7 @@ fn parse<'a>(
fn to_span(text: pulldown_cmark::CowStr) -> Span {
use std::ops::Deref;
Span::raw::<std::borrow::Cow<_>>(match text {
- CowStr::Borrowed(s) => s.to_string().into(), // could retain borrow
+ CowStr::Borrowed(s) => s.into(),
CowStr::Boxed(s) => s.to_string().into(),
CowStr::Inlined(s) => s.deref().to_owned().into(),
})
@@ -179,7 +179,9 @@ fn parse<'a>(
spans.push(Span::raw(" "));
}
Event::Rule => {
- lines.push(Spans::from("---"));
+ let mut span = Span::raw("---");
+ span.style = code_style;
+ lines.push(Spans::from(span));
lines.push(Spans::default());
}
// TaskListMarker(bool) true if checked
@@ -226,6 +228,7 @@ impl Component for Markdown {
return None;
}
let contents = parse(&self.contents, None, &self.config_loader);
+ // TODO: account for tab width
let max_text_width = (viewport.0 - padding).min(120);
let mut text_width = 0;
let mut height = padding;