diff options
| author | TheGeogeo <57634077+TheGeogeo@users.noreply.github.com> | 2026-11-24 22:48:14 +0100 |
|---|---|---|
| committer | TheGeogeo <57634077+TheGeogeo@users.noreply.github.com> | 2026-11-25 20:33:41 +0100 |
| commit | db3f77d45db9ddecd69c07dfa53b9bae4260841d (patch) | |
| tree | ef56664b91f65598952751d26e771da4ea235e69 /tools/progress_dashboard.py | |
| parent | cc5147134041ebe1b56379d0d14e573fc1ac536f (diff) | |
progress_dashboard: let the other separator continue a drive path with spaces (DASH-SCRUB-SPACES)
`D:/My work\name` and `D:\My work/name` were replaced only up to the space, so the file name stayed in the text.
Diffstat (limited to 'tools/progress_dashboard.py')
| -rw-r--r-- | tools/progress_dashboard.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/progress_dashboard.py b/tools/progress_dashboard.py index c77fd81a3..9ef57f9c6 100644 --- a/tools/progress_dashboard.py +++ b/tools/progress_dashboard.py | |||
| @@ -146,11 +146,14 @@ 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. | 149 | # separator, so `D:\My work\name` is one path and the prose after a path stays. The other separator continues it |
| 150 | # too (`D:/My work\name`), but only after a part with no dot or punctuation: the prose after a file has slashes. | ||
| 150 | drive = r"\b[a-z]:" | 151 | drive = r"\b[a-z]:" |
| 151 | quoted_path = rf"(?i:(?<='){drive}[\\/][^']*(?=')|(?<=\"){drive}[\\/][^\"]*(?=\"))" | 152 | quoted_path = rf"(?i:(?<='){drive}[\\/][^']*(?=')|(?<=\"){drive}[\\/][^\"]*(?=\"))" |
| 152 | more = r"(?:(?: +(?![a-z]:[\\/])[^\s'\"\\/]+)*? +(?![a-z]:[\\/])[^\s'\"\\/]+{sep}[^\s'\"]*)*" | 153 | more = r"(?:(?: +(?![a-z]:[\\/])[^\s'\"\\/]+)*? +(?![a-z]:[\\/])[^\s'\"\\/]+{sep}[^\s'\"]*)*" |
| 153 | drive_path = "(?i:" + "|".join(rf"{drive}{sep}[^\s'\"]*" + more.format(sep=sep) for sep in (r"\\", "/")) + ")" | 154 | folder = r"(?:[^\s'\"]*[\\/])?[^\s'\"\\/.,;:]*" |
| 155 | mixed = rf"(?:{folder}(?: +[^\s'\"\\/.,;:]+)*? +[^\s'\"\\/:]+[\\/])*" | ||
| 156 | drive_path = "(?i:" + "|".join(rf"{drive}{sep}{mixed}[^\s'\"]*" + more.format(sep=sep) for sep in (r"\\", "/")) + ")" | ||
| 154 | posix_path = r"(?<![\w.:/~])/[^\s/'\"][^\s'\"]*" | 157 | posix_path = r"(?<![\w.:/~])/[^\s/'\"][^\s'\"]*" |
| 155 | line = re.sub(rf"{quoted_path}|{checkout_path}|{drive_path}|{posix_path}", shown, line) | 158 | line = re.sub(rf"{quoted_path}|{checkout_path}|{drive_path}|{posix_path}", shown, line) |
| 156 | if HOME and len(HOME) > 3: | 159 | if HOME and len(HOME) > 3: |