From 2a203a7463c38e299a94e3fc124873eec8299b0a Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Mon, 5 Sep 2016 07:38:26 +0530 Subject: [PATCH] Fix merge conflicts from PR65. --- buku | 55 +++++++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/buku b/buku index eae509a..d58b831 100755 --- a/buku +++ b/buku @@ -1262,42 +1262,37 @@ def prompt(results, noninteractive=False, delete=False): except EOFError: return - if is_int(nav): - index = int(nav) - 1 - if index < 0 or index >= count: - logger.error('Index out of bound') - continue - - try: - browser_open(unquote(results[index][1])) - except Exception as e: - _, _, linenumber, func, _, _ = inspect.stack()[0] - logger.error('%s(), ln %d: %s', func, linenumber, e) - elif nav == 'a': - for index in range(0,count): + # iterate over whitespace separated indices + for nav in (' '.join(nav.split())).split(): + if is_int(nav): + index = int(nav) - 1 + if index < 0 or index >= count: + logger.error('Index out of bound') + continue try: browser_open(unquote(results[index][1])) except Exception as e: _, _, linenumber, func, _, _ = inspect.stack()[0] logger.error('%s(), ln %d: %s', func, linenumber, e) - elif '-' in nav and is_int(nav.split('-')[0]) and is_int(nav.split('-')[1]): - lower = int(nav.split('-')[0]) - upper = int(nav.split('-')[1]) - for index in range(lower-1,upper): - try: - browser_open(unquote(results[index][1])) - except Exception as e: - _, _, linenumber, func, _, _ = inspect.stack()[0] - logger.error('%s(), ln %d: %s', func, linenumber, e) - elif ' ' in nav and is_int(nav.split(' ')[0]) and is_int(nav.split(' ')[1]): - for index in nav.strip().split(' '): - try: - browser_open(unquote(results[int(index)-1][1])) - except Exception as e: - _, _, linenumber, func, _, _ = inspect.stack()[0] - logger.error('%s(), ln %d: %s', func, linenumber, e) + elif '-' in nav and is_int(nav.split('-')[0]) and is_int(nav.split('-')[1]): + lower = int(nav.split('-')[0]) + upper = int(nav.split('-')[1]) + for index in range(lower-1,upper): + try: + browser_open(unquote(results[index][1])) + except Exception as e: + _, _, linenumber, func, _, _ = inspect.stack()[0] + logger.error('%s(), ln %d: %s', func, linenumber, e) + else: + break else: - break + if nav == 'a': + for index in range(0, count): + try: + browser_open(unquote(results[index][1])) + except Exception as e: + _, _, linenumber, func, _, _ = inspect.stack()[0] + logger.error('%s(), ln %d: %s', func, linenumber, e) def print_record(row, count=0):