From 2fa6fb07c74ed1565b4a3a2bea4b47fe375db302 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sun, 18 Feb 2018 23:04:26 +0530 Subject: [PATCH] Handle 'O' and '?' in taglist subprompt These 2 inputs do not change the taglist. So we can do without losing context. In addition, defer the handling of error cases. --- buku.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/buku.py b/buku.py index e37783a..69fe7dd 100755 --- a/buku.py +++ b/buku.py @@ -3062,14 +3062,21 @@ def taglist_subprompt(obj, noninteractive=False): if is_int(nav) and int(nav) > 0 and int(nav) < count: return 't ' + unique_tags[int(nav) - 1] + elif nav == 't': + new_results = True + elif (nav in ('d', 'w', 'q') or + nav.startswith(('s ', 'S ', 'r ', 't ', 'o ', 'p ', 'g ', 'w ', 'c '))): + return nav + elif nav == 'O': + browse.override_text_browser = not browse.override_text_browser + print('text browser override toggled') + new_results = False + elif nav == '?': + ExtendedArgumentParser.prompt_help(sys.stdout) + new_results = False elif is_int(nav): print('No matching index %s' % nav) new_results = False - elif nav == 't': - new_results = True - elif (nav == 'q' or nav == 'd' or nav == '?' or nav == 'O' or - nav.startswith(('s ', 'S ', 'r ', 't ', 'o ', 'p ', 'g ', 'w ', 'c ')) or nav == 'w'): - return nav else: print('Invalid input') new_results = False