Skip to content

Commit e45c56c

Browse files
Merge branch 'fix-just-499'
fixes bpython#499
2 parents 80d86f2 + 1f2e808 commit e45c56c

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

bpython/config.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,12 @@ def loadini(struct, configfile):
107107
'exit': '',
108108
'external_editor': 'F7',
109109
'help': 'F1',
110+
'incremental_search': 'M-s',
110111
'last_output': 'F9',
111112
'left': 'C-b',
112113
'pastebin': 'F8',
113114
'reimport': 'F6',
115+
'reverse_incremental_search': 'M-r',
114116
'right': 'C-f',
115117
'save': 'C-s',
116118
'search': 'C-o',
@@ -185,6 +187,9 @@ def get_key_no_doublebind(command):
185187
struct.toggle_file_watch_key = get_key_no_doublebind('toggle_file_watch')
186188
struct.undo_key = get_key_no_doublebind('undo')
187189
struct.reimport_key = get_key_no_doublebind('reimport')
190+
struct.reverse_incremental_search_key = get_key_no_doublebind(
191+
'reverse_incremental_search')
192+
struct.incremental_search_key = get_key_no_doublebind('incremental_search')
188193
struct.up_one_line_key = get_key_no_doublebind('up_one_line')
189194
struct.down_one_line_key = get_key_no_doublebind('down_one_line')
190195
struct.cut_to_buffer_key = get_key_no_doublebind('cut_to_buffer')
@@ -200,8 +205,6 @@ def get_key_no_doublebind(command):
200205
struct.end_of_line_key = get_key_no_doublebind('end_of_line')
201206
struct.beginning_of_line_key = get_key_no_doublebind('beginning_of_line')
202207
struct.transpose_chars_key = get_key_no_doublebind('transpose_chars')
203-
struct.clear_line_key = get_key_no_doublebind('clear_line')
204-
struct.clear_screen_key = get_key_no_doublebind('clear_screen')
205208
struct.exit_key = get_key_no_doublebind('exit')
206209
struct.last_output_key = get_key_no_doublebind('last_output')
207210
struct.edit_config_key = get_key_no_doublebind('edit_config')
@@ -266,10 +269,6 @@ def get_key_no_doublebind(command):
266269
(color_scheme_name, ))
267270
sys.exit(1)
268271

269-
# checks for valid key configuration this part still sucks
270-
for key in (struct.pastebin_key, struct.save_key):
271-
key_dispatch[key]
272-
273272
# expand path of history file
274273
struct.hist_file = os.path.expanduser(struct.hist_file)
275274

bpython/curtsiesfrontend/manual_readline.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,9 @@ def transpose_character_before_cursor(cursor_offset, line):
291291
def transpose_word_before_cursor(cursor_offset, line):
292292
return cursor_offset, line # TODO Not implemented
293293

294-
# bonus functions (not part of readline)
295-
296-
297-
@edit_keys.on('<Esc+r>')
298-
def delete_line(cursor_offset, line):
299-
return 0, ""
294+
# TODO undo all changes to line: meta-r
300295

296+
# bonus functions (not part of readline)
301297

302298
@edit_keys.on('<Esc+u>')
303299
def uppercase_next_word(cursor_offset, line):

bpython/curtsiesfrontend/repl.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ def load_module(self, name):
245245
self.watcher.track_module(module.__file__)
246246
return module
247247

248+
def get_data(self, pathname):
249+
return open(pathname, "rb").read()
250+
248251

249252
class ImportFinder(object):
250253

@@ -608,9 +611,9 @@ def process_key_event(self, e):
608611
self.on_control_d()
609612
elif e in ("<Esc+.>",):
610613
self.get_last_word()
611-
elif e in ("<Esc+r>",):
614+
elif e in key_dispatch[self.config.reverse_incremental_search_key]:
612615
self.incremental_search(reverse=True)
613-
elif e in ("<Esc+s>",):
616+
elif e in key_dispatch[self.config.incremental_search_key]:
614617
self.incremental_search()
615618
elif (e in ("<BACKSPACE>",) + key_dispatch[self.config.backspace_key]
616619
and self.incremental_search_mode):

bpython/sample-config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777
# exit = C-d
7878
# external_editor = F7
7979
# edit_config = F3
80+
# reverse_incremental_search = M-r
81+
# incremental_search = M-s
8082

8183
[curtsies]
8284

0 commit comments

Comments
 (0)