diff --git a/Screenshot 2026-01-24 at 19.45.24.png b/Screenshot 2026-01-24 at 19.45.24.png deleted file mode 100644 index 211ddc8..0000000 Binary files a/Screenshot 2026-01-24 at 19.45.24.png and /dev/null differ diff --git a/pyproject.toml b/pyproject.toml index d973557..bf3a4b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "textual-webterm" -version = "0.3.12" +version = "0.3.13" description = "Serve terminal sessions over the web" authors = ["Will McGugan "] license = "MIT" diff --git a/src/textual_webterm/svg_exporter.py b/src/textual_webterm/svg_exporter.py index 5fe4e5d..8549ee0 100644 --- a/src/textual_webterm/svg_exporter.py +++ b/src/textual_webterm/svg_exporter.py @@ -207,11 +207,12 @@ def render_terminal_svg( char_cols = 2 # Wide character # Background rect if not default + # Add 0.5px overlap in both directions to eliminate sub-pixel gaps at high zoom if bg != background: - bg_width = char_cols * char_width + bg_width = char_cols * char_width + 0.5 row_bg_rects.append( f'' ) diff --git a/tests/test_svg_exporter.py b/tests/test_svg_exporter.py index b16b0fb..2ec9b04 100644 --- a/tests/test_svg_exporter.py +++ b/tests/test_svg_exporter.py @@ -300,15 +300,15 @@ class TestRenderTerminalSvg: self._char("", bg="red"), # Placeholder inherits bg ]] svg = render_terminal_svg(buffer, width=80, height=24, char_width=10.0) - # Background should span 2 columns (20px width) + # Background should span 2 columns (20px width + 0.5px overlap) assert f'fill="{ANSI_COLORS["red"]}"' in svg - # Verify rect width is for 2 columns + # Verify rect width is for 2 columns plus overlap import re rect_match = re.search(r']*width="(\d+\.?\d*)"[^>]*fill="{}"/>' .format(ANSI_COLORS["red"]), svg) assert rect_match is not None width = float(rect_match.group(1)) - assert width == 20.0 # 2 columns * 10.0 char_width + assert width == 20.5 # 2 columns * 10.0 char_width + 0.5 overlap def test_background_same_as_terminal_bg_no_rect(self) -> None: """Background same as terminal background doesn't create extra rect."""