From a87b9a4d16309f3a286a44307c224ea835200863 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 17 Nov 2026 04:23:01 +0100 Subject: [PATCH] Fold the blank-text and length guards of code_span into one padding rule, which the hand mutants of its lines all fail --- bin/touch_predictions/prediction.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/bin/touch_predictions/prediction.py b/bin/touch_predictions/prediction.py index fb474b13..9503cb7a 100644 --- a/bin/touch_predictions/prediction.py +++ b/bin/touch_predictions/prediction.py @@ -81,12 +81,9 @@ def code_span(line: str, at: int) -> tuple[str, int] | None: if opened is None or closed is None: return None text = line[opened.end():opened.end() + closed.start()] - if len(run) > 1: - if not text.strip(): - return None - # A space at both ends is padding, which keeps a backtick at either end of the text apart from the run. Without one at both ends, the span is its text. - if len(text) >= 3 and text.startswith(" ") and text.endswith(" "): - text = text[1:-1] + # In a longer run, a space at both ends is padding, which keeps a backtick at either end of the text apart from the run. Without one at both ends, the span is its text. + if len(run) > 1 and text.startswith(" ") and text.endswith(" "): + text = text[1:-1] return (text, opened.end() + closed.end()) if text else None