[accerciser: 1/4] ipython_view: Clear text after cursor on Ctrl+K
- From: Samuel Thibault <sthibaul src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [accerciser: 1/4] ipython_view: Clear text after cursor on Ctrl+K
- Date: Wed, 3 Aug 2022 09:40:17 +0000 (UTC)
commit 3c40356b5a4875665408a7290e4fbfb2c8b8a3e8
Author: Michael Weghorn <m weghorn posteo de>
Date: Wed Aug 3 09:55:23 2022 +0200
ipython_view: Clear text after cursor on Ctrl+K
This adds the functionality to clear the text
after the input cursor in the iypthon_view when
pressing Ctrl+K (with either lower- or upper-case 'K'),
as is possible when running a standalone interactive
IPython shell in common terminal emulators.
plugins/ipython_view.py | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/plugins/ipython_view.py b/plugins/ipython_view.py
index 86ebbb8..a08ab7e 100755
--- a/plugins/ipython_view.py
+++ b/plugins/ipython_view.py
@@ -575,6 +575,11 @@ class ConsoleView(gtk.TextView):
self.text_buffer.move_mark(self.line_start, self.text_buffer.get_iter_at_offset(len(self.prompt)))
self.text_buffer.place_cursor(self.text_buffer.get_iter_at_offset(cursor_pos_in_line))
return True
+ elif event.state & gdk.ModifierType.CONTROL_MASK and event.keyval in [gdk.KEY_k, gdk.KEY_K]:
+ # clear text after input cursor on Ctrl+K
+ if insert_iter.editable(True):
+ self.text_buffer.delete(insert_iter, self.text_buffer.get_end_iter())
+ return True
elif not event.string:
pass
elif start_iter.compare(insert_iter) <= 0 and \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]