implement ellipsis and add some comments

This commit is contained in:
Guillaume Leclerc 2016-05-19 16:14:53 +02:00
parent b4157321a6
commit eec7c0992d

View file

@ -1041,8 +1041,14 @@ def _dynamically_collapsed_pwd():
parts.append(last)
full = sep.join(parts)
# If even if displaying one letter per dir we are too long
if (len(full) > target_width):
full = full[int(-target_width):]
# We truncate the left most part
full = "..." + full[int(-target_width) + 3:]
# if there is not even a single separator we still
# want to display at least the beginning of the directory
if full.find(sep) == -1:
full = ("..." + sep + last)[0:int(target_width)]
return full
def _current_job():