1
0
mirror of https://github.com/openSUSE/osc.git synced 2026-01-29 09:13:02 +01:00

Highlight trailing whitespaces in diffs

This commit is contained in:
2025-02-21 14:13:45 +01:00
parent ea24281859
commit 897e2224e0

View File

@@ -1935,6 +1935,11 @@ def get_default_editor():
def format_diff_line(line):
# highlight trailing whitespaces
match = re.search(rb"(\s+)$", line)
if match:
line = line[:match.start(1)] + b"\x1b[41m" + line[match.start(1):] + b"\x1b[0m"
if line.startswith(b"+++ ") or line.startswith(b"--- ") or line.startswith(b"Index:"):
line = b"\x1b[1m" + line + b"\x1b[0m"
elif line.startswith(b"+"):