diff options
author | Florent Le Coz <louiz@louiz.org> | 2013-02-03 22:17:22 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2013-02-03 22:17:22 +0100 |
commit | a76b016f953b9a3e670d7c186403fa059ecb1d0a (patch) | |
tree | dd8e2b83ae3d1420930a728e8c569f0cba946442 | |
parent | dd9f6936be045cab2c6a3e3c927e161640f0705c (diff) | |
download | poezio-a76b016f953b9a3e670d7c186403fa059ecb1d0a.tar.gz poezio-a76b016f953b9a3e670d7c186403fa059ecb1d0a.tar.bz2 poezio-a76b016f953b9a3e670d7c186403fa059ecb1d0a.tar.xz poezio-a76b016f953b9a3e670d7c186403fa059ecb1d0a.zip |
Add a key (Alt+d) de delete the next word in the input.
-rw-r--r-- | src/windows.py | 15 |
1 files changed, 15 insertions, 0 deletions
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 |