diff --git a/bpython/curtsiesfrontend/repl.py b/bpython/curtsiesfrontend/repl.py index 419c9fce1..d40f347e3 100644 --- a/bpython/curtsiesfrontend/repl.py +++ b/bpython/curtsiesfrontend/repl.py @@ -46,7 +46,9 @@ #TODO other autocomplete modes (also fix in other bpython implementations) + from curtsies.configfile_keynames import keymap as key_dispatch +print 'hello' logger = logging.getLogger(__name__) @@ -87,6 +89,7 @@ def __init__(self, coderunner, repl, configured_edit_keys=None): def process_event(self, e): assert self.has_focus + logger.debug('fake input processing event %r', e) if isinstance(e, events.PasteEvent): for ee in e.events: @@ -100,6 +103,9 @@ def process_event(self, e): self.current_line = '' self.cursor_offset = 0 self.repl.run_code_and_maybe_finish() + elif e in ("",): + self.last_word() + elif e in [""]: pass elif e in ['']: @@ -469,6 +475,8 @@ def process_key_event(self, e): self.down_one_line() elif e in ("",): self.on_control_d() + elif e in ("",): + self.last_word() elif e in ("",): self.incremental_search(reverse=True) elif e in ("",): @@ -524,6 +532,12 @@ def process_key_event(self, e): else: self.add_normal_character(e) + def last_word(self): + the_history=self.rl_history.entries + the_line=the_history.pop() + the_word=the_line.split().pop() + self.current_line=self.current_line +the_word + def incremental_search(self, reverse=False, include_current=False): if self.special_mode == None: self.rl_history.enter(self.current_line)