Replace println with log calls in markdown module

This commit is contained in:
Héctor Ramón Jiménez 2025-01-31 20:42:53 +01:00
parent 4b8fc23840
commit bc2d662af7
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
3 changed files with 9 additions and 3 deletions

1
Cargo.lock generated
View file

@ -2640,6 +2640,7 @@ dependencies = [
"iced_highlighter",
"iced_renderer",
"iced_runtime",
"log",
"num-traits",
"ouroboros",
"pulldown-cmark",

View file

@ -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

View file

@ -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();
}