From a76b016f953b9a3e670d7c186403fa059ecb1d0a Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sun, 3 Feb 2013 22:17:22 +0100 Subject: Add a key (Alt+d) de delete the next word in the input. --- src/windows.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/windows.py b/src/windows.py index 3975bf33..c2d4ab60 100644 --- a/src/windows.py +++ b/src/windows.py @@ -1109,6 +1109,7 @@ class Input(Win): 'M-b': self.jump_word_left, "M-[1;5D": self.jump_word_left, '^W': self.delete_word, + 'M-d': self.delete_next_word, '^K': self.delete_end_of_line, '^U': self.delete_begining_of_line, '^Y': self.paste_clipboard, @@ -1182,6 +1183,20 @@ class Input(Win): return True + def delete_next_word(self): + """ + Delete the word just after the cursor + """ + log.debug("delete_next_word") + if len(self.text) == self.pos+self.line_pos or not len(self.text): + return + separators = string.punctuation+' ' + while len(self.text) != self.pos+self.line_pos and self.text[self.pos+self.line_pos] in separators: + self.key_dc() + while len(self.text) != self.pos+self.line_pos and self.text[self.pos+self.line_pos] not in separators: + self.key_dc() + return True + def delete_end_of_line(self): """ Cut the text from cursor to the end of line -- cgit v1.2.3