From c9447cb8e2711af89fbb7e8b9030b8128e6e1845 Mon Sep 17 00:00:00 2001
From: Chris Emerson <github@mail.nosreme.org>
Date: Fri, 22 Nov 2024 22:08:14 +0000
Subject: [PATCH] Fix a miscalculation of line length leading to a debug
 assert.

Thanks @JadedBlueEyes for the report.
---
 src/render/text_renderer.rs | 1 -
 src/tests.rs                | 6 ++++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/render/text_renderer.rs b/src/render/text_renderer.rs
index 8680658..c584ebc 100644
--- a/src/render/text_renderer.rs
+++ b/src/render/text_renderer.rs
@@ -218,7 +218,6 @@ impl<T: Debug + Eq + PartialEq + Clone + Default> TaggedLine<T> {
             s: " ".repeat(len),
             tag: tag.clone(),
         }));
-        self.len += len;
     }
 
     /// Add a new fragment to the start of the line
diff --git a/src/tests.rs b/src/tests.rs
index 6513a09..d78298f 100644
--- a/src/tests.rs
+++ b/src/tests.rs
@@ -2087,6 +2087,12 @@ foo
     );
 }
 
+#[test]
+fn test_issue_187() {
+    let html = br#"<div><table><tbody><tr><td><div><table><tbody><tr><td><div><pre>na na na na na na na na na na na na na na na</p></div></td></tr>/<tbody></table></div></td></tr>/<tbody></table></div>"#;
+    let _ = crate::config::plain().string_from_read(&html[..], 17);
+}
+
 #[cfg(feature = "css")]
 mod css_tests {
     use super::{