Skip to content

Commit 6c4c5e5

Browse files
Fixed highlighting of the 'NoMatch' part of the reverse search.
1 parent 7cbf87a commit 6c4c5e5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

prompt_toolkit/line.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,15 @@ def set_search_text(self, text):
584584
if not self.isearch_state:
585585
self.start_isearch()
586586

587-
# When `text` is not a suffix of the search string that we had.
588-
if not text.startswith(self.isearch_state.isearch_text):
587+
# When backspace has been pressed.
588+
if self.isearch_state.no_match_from_index and \
589+
self.isearch_state.isearch_text.startswith(text):
590+
if len(text) < self.isearch_state.no_match_from_index:
591+
self.isearch_state.no_match_from_index = None
592+
593+
# When not appending text.
594+
# (When `text` is not a suffix of the search string that we had.)
595+
elif not text.startswith(self.isearch_state.isearch_text):
589596
self.isearch_state.no_match_from_index = None
590597

591598
self.working_index = self.isearch_state.original_working_index

0 commit comments

Comments
 (0)