Viewer search: Fix jumping to next match sometimes selecting previous match if the searched for expression occurs with identical context in multiple places. Fixes #1868633 [Private bug](https://bugs.launchpad.net/calibre/+bug/1868633)

This commit is contained in:
Kovid Goyal 2020-03-25 11:40:00 +05:30
parent b887ca602a
commit ac12d5933a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -79,7 +79,7 @@ def find_specific_occurrence(q, num, before_len, after_len, text_map):
break
match_num += 1
from_idx = idx + 1
if num < match_num:
if match_num < num:
continue
start_node, start_offset, node_pos = find_node_for_index_binary(text_map.node_list, idx + before_len, pos)
if start_node is not None: