Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfc7ee66

Browse files
don't include current search string as target for incremental search
1 parente318b6b commitfc7ee66

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

‎bpython/curtsiesfrontend/repl.py‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -524,12 +524,16 @@ def incremental_search(self, reverse=False):
524524
else:
525525
self.special_mode='incremental_search'
526526
else:
527-
self._set_current_line(self.rl_history.back(False,search=True)
528-
ifreverseelse
529-
self.rl_history.forward(False,search=True),
530-
reset_rl_history=False,clear_special_mode=False)
531-
self._set_cursor_offset(len(self.current_line),reset_rl_history=False,
532-
clear_special_mode=False)
527+
ifself.rl_history.saved_line:
528+
line= (self.rl_history.back(False,search=True)
529+
ifreverseelse
530+
self.rl_history.forward(False,search=True))
531+
ifself.rl_history.is_at_start:
532+
line=''# incremental search's search string isn't the current line
533+
self._set_current_line(line,
534+
reset_rl_history=False,clear_special_mode=False)
535+
self._set_cursor_offset(len(self.current_line),
536+
reset_rl_history=False,clear_special_mode=False)
533537

534538
defreadline_kill(self,e):
535539
func=self.edit_keys[e]
@@ -695,6 +699,10 @@ def add_normal_character(self, char):
695699
self.cursor_offset=max(0,self.cursor_offset-4)
696700

697701
defadd_to_incremental_search(self,char=None,backspace=False):
702+
"""Modify the current search term while in incremental search.
703+
704+
The only operations allowed in incremental search mode are
705+
adding characters and backspacing."""
698706
ifcharisNoneandnotbackspace:
699707
raiseValueError("must provide a char or set backspace to True")
700708
saved_line=self.rl_history.saved_line

‎bpython/repl.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ def writetb(self, lines):
139139

140140

141141
classHistory(object):
142+
"""Stores readline-style history allows access to it"""
142143

143144
def__init__(self,entries=None,duplicates=False):
144145
ifentriesisNone:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp