diff options
| author | TheGeogeo <57634077+TheGeogeo@users.noreply.github.com> | 2026-11-28 16:50:14 +0100 |
|---|---|---|
| committer | TheGeogeo <57634077+TheGeogeo@users.noreply.github.com> | 2026-11-28 16:50:14 +0100 |
| commit | 09ce9de45a50bc5e54d3d9244ea03363ebe68a4a (patch) | |
| tree | a53342cd5e388bfca7eb26b9373df9ff1e2bdcd9 /tools/progress_dashboard.py | |
| parent | db3f77d45db9ddecd69c07dfa53b9bae4260841d (diff) | |
progress_dashboard: keep the prose after a file name with the same separator (DASH-SCRUB-SPACES)
An unquoted drive path went on over a space whenever a later word had its
separator, so `D:/work/a.txt and tests/test_x.py failed` became
`<path> failed`. The same separator now continues a path only after a part
with no dot or punctuation, as the other separator already did, so the
prose after a file name stays.
Diffstat (limited to 'tools/progress_dashboard.py')
| -rw-r--r-- | tools/progress_dashboard.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/progress_dashboard.py b/tools/progress_dashboard.py index 9ef57f9c6..275e867e9 100644 --- a/tools/progress_dashboard.py +++ b/tools/progress_dashboard.py | |||
| @@ -146,14 +146,16 @@ def scrub(text, limit=240): | |||
| 146 | # Consume a same-prefix sibling too, so shown() can redact its entire path. | 146 | # Consume a same-prefix sibling too, so shown() can redact its entire path. |
| 147 | checkout_path = rf"{checkout}[^\s'\"]*" | 147 | checkout_path = rf"{checkout}[^\s'\"]*" |
| 148 | # A quoted drive path ends at its quote. An unquoted one goes on over spaces while a later part still has its | 148 | # A quoted drive path ends at its quote. An unquoted one goes on over spaces while a later part still has its |
| 149 | # separator, so `D:\My work\name` is one path and the prose after a path stays. The other separator continues it | 149 | # separator, so `D:\My work\name` is one path, but only after a part with no dot or punctuation: the prose after |
| 150 | # too (`D:/My work\name`), but only after a part with no dot or punctuation: the prose after a file has slashes. | 150 | # a file name stays, slashes included (`D:/work/a.txt and tests/test_x.py`). The other separator continues it too |
| 151 | # (`D:/My work\name`), with no punctuation in the words before that part. | ||
| 151 | drive = r"\b[a-z]:" | 152 | drive = r"\b[a-z]:" |
| 152 | quoted_path = rf"(?i:(?<='){drive}[\\/][^']*(?=')|(?<=\"){drive}[\\/][^\"]*(?=\"))" | 153 | quoted_path = rf"(?i:(?<='){drive}[\\/][^']*(?=')|(?<=\"){drive}[\\/][^\"]*(?=\"))" |
| 153 | more = r"(?:(?: +(?![a-z]:[\\/])[^\s'\"\\/]+)*? +(?![a-z]:[\\/])[^\s'\"\\/]+{sep}[^\s'\"]*)*" | ||
| 154 | folder = r"(?:[^\s'\"]*[\\/])?[^\s'\"\\/.,;:]*" | 154 | folder = r"(?:[^\s'\"]*[\\/])?[^\s'\"\\/.,;:]*" |
| 155 | mixed = rf"(?:{folder}(?: +[^\s'\"\\/.,;:]+)*? +[^\s'\"\\/:]+[\\/])*" | 155 | mixed = r"(?: +[^\s'\"\\/.,;:]+)*? +[^\s'\"\\/:]+[\\/]" |
| 156 | drive_path = "(?i:" + "|".join(rf"{drive}{sep}{mixed}[^\s'\"]*" + more.format(sep=sep) for sep in (r"\\", "/")) + ")" | 156 | more = r"(?: +(?![a-z]:[\\/])[^\s'\"\\/]+)*? +(?![a-z]:[\\/])[^\s'\"\\/]+{sep}" |
| 157 | drive_path = "(?i:" + "|".join(rf"{drive}{sep}(?:{folder}(?:{mixed}|{more.format(sep=sep)}))*[^\s'\"]*" | ||
| 158 | for sep in (r"\\", "/")) + ")" | ||
| 157 | posix_path = r"(?<![\w.:/~])/[^\s/'\"][^\s'\"]*" | 159 | posix_path = r"(?<![\w.:/~])/[^\s/'\"][^\s'\"]*" |
| 158 | line = re.sub(rf"{quoted_path}|{checkout_path}|{drive_path}|{posix_path}", shown, line) | 160 | line = re.sub(rf"{quoted_path}|{checkout_path}|{drive_path}|{posix_path}", shown, line) |
| 159 | if HOME and len(HOME) > 3: | 161 | if HOME and len(HOME) > 3: |