Highlight path separators to make paths easier to read.

This commit is contained in:
Andrew Hamilton 2020-02-03 00:42:04 +10:00
parent c4da4123f7
commit d709e5069d

View file

@ -724,8 +724,13 @@ def path_colored(path):
return termstr.TermStr(basename, char_style)
else:
dirname = dirname + os.path.sep
return (termstr.TermStr(dirname, _charstyle_of_path(dirname)) +
termstr.TermStr(basename, char_style))
dir_style = _charstyle_of_path(os.path.sep)
parts = [termstr.TermStr(part, dir_style)
for part in dirname.split(os.path.sep)]
path_sep = termstr.TermStr(os.path.sep).fg_color(
termstr.Color.grey_100)
dir_name = fill3.join(path_sep, parts)
return dir_name + termstr.TermStr(basename, char_style)
@functools.lru_cache(maxsize=100)