1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-24 08:45:13 +00:00

Merge pull request #1629 from ThomasWaldmann/fix-narrow-terminal-crash

adapt formatting to narrow screens, do not crash, fixes #1628
This commit is contained in:
TW 2016-09-23 03:30:02 +02:00 committed by GitHub
commit 79617d4e74

View file

@ -223,6 +223,10 @@ def show_progress(self, item=None, final=False, stream=None, dt=None):
msg = '{0.osize_fmt} O {0.csize_fmt} C {0.usize_fmt} D {0.nfiles} N '.format(self)
path = remove_surrogates(item[b'path']) if item else ''
space = columns - len(msg)
if space < 12:
msg = ''
space = columns - len(msg)
if space >= 8:
if space < len('...') + len(path):
path = '%s...%s' % (path[:(space // 2) - len('...')], path[-space // 2:])
msg += "{0:<{space}}".format(path, space=space)