From ca3fb9dfb5ee042ece3f5fbc42c9a04b65bf7b8f Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Wed, 10 Jul 2024 05:00:47 +0100 Subject: [PATCH] Don't trim comments to the right We use fixed-width comments to align `// gap` annotations and the `// ...` position-visualization. With the previous behaviour of `SourceLine._strip_comments()`, the right-padding of the `gap` comment would be removed, leading to misaligned output. This commit modifies comment trimming to use lstrip() only. --- slothy/helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slothy/helper.py b/slothy/helper.py index 016b7576..1ab47866 100644 --- a/slothy/helper.py +++ b/slothy/helper.py @@ -83,7 +83,7 @@ def tag_callback(g): return s def _strip_comments(self): - self._comments = list(map(str.strip, self._comments)) + self._comments = list(map(str.lstrip, self._comments)) def _trim_comments(self): self._strip_comments()