diff kitten: Use a single-width replacement for control chars
Preserves text width better, and conveys the essential message, namely non-printable characters. Most people wont know what <hex code> is in any case.
This commit is contained in:
parent
5dfb8b1d80
commit
22cffef7c8
@ -116,13 +116,9 @@ def collect_files(collection, left, right):
|
||||
sanitize_pat = re.compile('[\x00-\x09\x0b-\x1f\x7f\x80-\x9f]')
|
||||
|
||||
|
||||
def sanitize_sub(m):
|
||||
return '<{:x}>'.format(ord(m.group()[0]))
|
||||
|
||||
|
||||
def sanitize(text):
|
||||
ntext = text.replace('\r\n', '⏎\n')
|
||||
return sanitize_pat.sub(sanitize_sub, ntext)
|
||||
return sanitize_pat.sub('░', ntext)
|
||||
|
||||
|
||||
@lru_cache(maxsize=1024)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user