diff options
author | wustho <benawiadha@gmail.com> | 2020-04-19 11:45:25 +0700 |
---|---|---|
committer | wustho <benawiadha@gmail.com> | 2020-04-19 11:45:25 +0700 |
commit | e03619c5e80803e930b2e684a6116fbc83f336f9 (patch) | |
tree | 7054ff7a40682efcf62e0a35eae98f3590aa1de9 /epy.py | |
parent | 14a199b0f080a858797b1bdaf5665ee46bdff833 (diff) | |
download | epy-e03619c5e80803e930b2e684a6116fbc83f336f9.tar.gz |
Better display reading history.
Diffstat (limited to 'epy.py')
-rwxr-xr-x | epy.py | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -1548,9 +1548,20 @@ def main(): if xitmsg != 0 or "-r" in args: print("Reading history:") dig = len(str(len(STATE["States"].keys())+1)) + tcols, _ = shutil.get_terminal_size() + tcols -= dig + 2 + tcolswdots = tcols - 3 + tcolsa = 7 # tcolswdots//2 + tcolsb = tcolswdots - tcolsa for n, i in enumerate(STATE["States"].keys()): - print(str(n+1).rjust(dig) - + ("* " if STATE["LastRead"] == i else " ") + i) + # print(str(n+1).rjust(dig) + # + ("* " if STATE["LastRead"] == i else " ") + i) + p = i.replace(os.getenv("HOME"), "~") + print("{}{} {}".format( + str(n+1).rjust(dig), + "*" if i == STATE["LastRead"] else " ", + p if len(p) <= tcols else p[:tcolsa] + "..." + p[-tcolsb:] + )) sys.exit(xitmsg) if dump: |