Skip to content

Commit

Permalink
Replace println with log calls in markdown module
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Jan 31, 2025
1 parent 4b8fc23 commit bc2d662
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions widget/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ iced_renderer.workspace = true
iced_runtime.workspace = true

num-traits.workspace = true
log.workspace = true
rustc-hash.workspace = true
thiserror.workspace = true
unicode-segmentation.workspace = true
Expand Down
10 changes: 7 additions & 3 deletions widget/src/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,18 +313,22 @@ impl Highlighter {
Some(line) if line.0 == text => {}
_ => {
if self.current + 1 < self.lines.len() {
println!("Resetting...");
log::debug!("Resetting highlighter...");
self.parser.reset();
self.lines.truncate(self.current);

for line in &self.lines {
println!("Refeeding {n} lines", n = self.lines.len());
log::debug!(
"Refeeding {n} lines",
n = self.lines.len()
);

let _ = self.parser.highlight_line(&line.0);
}
}

println!("Parsing: {text}", text = text.trim_end());
log::trace!("Parsing: {text}", text = text.trim_end());

if self.current + 1 < self.lines.len() {
self.parser.commit();
}
Expand Down

0 comments on commit bc2d662

Please sign in to comment.