diff --git a/IPython/Extensions/ibrowse.py b/IPython/Extensions/ibrowse.py index cae6bb9..e7132a1 100644 --- a/IPython/Extensions/ibrowse.py +++ b/IPython/Extensions/ibrowse.py @@ -476,11 +476,14 @@ class _CommandInput(object): 127: "backspace", curses.KEY_BACKSPACE: "backspace", curses.KEY_DC: "delete", - ord("x"): "delete", + # CTRL-K + 0x0B: "delend", ord("\n"): "execute", ord("\r"): "execute", curses.KEY_UP: "up", curses.KEY_DOWN: "down", + curses.KEY_PPAGE: "incsearchup", + curses.KEY_NPAGE: "incsearchdown", # CTRL-X 0x18: "exit", } @@ -537,6 +540,11 @@ class _CommandInput(object): else: curses.beep() + def cmd_delend(self, browser): + if self.curx= len(self.history): + break + if self.history[cury].startswith(prefix): + self.input = self.history[cury] + self.cury = cury + return True + curses.beep() + + def cmd_incsearchdown(self, browser): + prefix = self.input[:self.curx] + cury = self.cury + while True: + cury -= 1 + if cury <= 0: + break + if self.history[cury].startswith(prefix): + self.input = self.history[self.cury] + self.cury = cury + return True + curses.beep() + def cmd_exit(self, browser): browser.mode = "default" return True diff --git a/doc/ChangeLog b/doc/ChangeLog index 79c8284..53bdc5f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -5,7 +5,12 @@ the cursor. "unhiderattrs" (mapped to "H") reveals all hidden attributes again. Remapped the help command to "?". Display keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e - as keys for the "home" and "end" commands. + as keys for the "home" and "end" commands. Add three new commands + to the input mode for "find" and friends: "delend" (CTRL-K) + deletes to the end of line. "incsearchup" searches upwards in the + command history for an input that starts with the text before the cursor. + "incsearchdown" does the same downwards. Removed a bogus mapping of + the x key to "delete". 2006-06-15 Ville Vainio