From bcc4fb0c6d687db25838fd51f2bdbc75001992ed Mon Sep 17 00:00:00 2001 From: GitHub Copilot Date: Sat, 24 Jan 2026 19:07:11 +0000 Subject: [PATCH] Limit box-drawing detection to actual box chars (U+2500-U+257F) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Block elements (█▀▄) and geometric shapes should merge normally. Only box-drawing lines/corners/junctions need separate positioning. --- src/textual_webterm/svg_exporter.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/textual_webterm/svg_exporter.py b/src/textual_webterm/svg_exporter.py index 5ce1c8a..cfe77d1 100644 --- a/src/textual_webterm/svg_exporter.py +++ b/src/textual_webterm/svg_exporter.py @@ -256,14 +256,18 @@ class _Span(TypedDict): def _is_box_drawing(char: str) -> bool: - """Check if character is a box-drawing or block element that needs precise positioning.""" + """Check if character is a box-drawing character that needs precise positioning. + + Only actual box-drawing characters (lines, corners) need separate positioning. + Block elements (█▀▄ etc.) can merge as they're often used in sequences. + """ if not char: return False code = ord(char[0]) - # Box Drawing: U+2500-U+257F - # Block Elements: U+2580-U+259F - # Geometric Shapes (some): U+25A0-U+25FF - return 0x2500 <= code <= 0x259F or 0x25A0 <= code <= 0x25FF + # Box Drawing only: U+2500-U+257F (lines, corners, junctions) + # NOT block elements (U+2580-U+259F) - those can merge + # NOT geometric shapes (U+25A0-U+25FF) - those can merge + return 0x2500 <= code <= 0x257F def _should_break_span(current_text: str, new_char: str) -> bool: