Skip to content

Commit

Permalink
Always stop code text style
Browse files Browse the repository at this point in the history
On the start of a code block the code text style was enabled. However
upon ending the code block, the style was only disabled for _fenced_ code
blocks. This prevents the code style from bleeding into other widgets.
  • Loading branch information
lampsitter committed Sep 7, 2024
1 parent d396190 commit bba8ec6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion egui_commonmark/src/parsers/pulldown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@ impl CommonMarkViewerInternal {
pulldown_cmark::TagEnd::CodeBlock => {
self.end_code_block(ui, cache, options, max_width);
}

pulldown_cmark::TagEnd::List(_) => {
self.line.should_start_newline = true;
self.line.should_end_newline = true;
Expand Down Expand Up @@ -740,8 +741,8 @@ impl CommonMarkViewerInternal {
) {
if let Some(block) = self.fenced_code_block.take() {
block.end(ui, cache, options, max_width);
self.text_style.code = false;
self.line.try_insert_end(ui);
}
self.text_style.code = false;
}
}
3 changes: 2 additions & 1 deletion egui_commonmark_macros/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -817,10 +817,11 @@ impl CommonMarkViewerInternal {
.end(ui, #cache, &options, max_width);
));

self.text_style.code = false;
stream.extend(self.line.try_insert_end());
}

self.text_style.code = false;

stream
}

Expand Down

0 comments on commit bba8ec6

Please sign in to comment.