diff options
author | Sören Tempel <soeren+git@soeren-tempel.net> | 2021-05-16 23:43:07 +0200 |
---|---|---|
committer | Sören Tempel <soeren+git@soeren-tempel.net> | 2021-05-16 23:43:07 +0200 |
commit | d06dea868fb8ceb51c07c4cc1b12fd5a312ed996 (patch) | |
tree | b700055244865c6cb473f6a191bb0da2554366ef | |
parent | ea4dcc3b00f92c35273153d824a611c4f4acaf7f (diff) |
Add keybinding to jump to start of input
-rw-r--r-- | src/input.py | 1 | ||||
-rw-r--r-- | src/terminal.py | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/input.py b/src/input.py index 6798ad1..7394260 100644 --- a/src/input.py +++ b/src/input.py @@ -8,6 +8,7 @@ class KeyBindings(): stylesheet = b""" @binding-set saneterm-key-bindings { bind "<ctrl>u" { "kill-after-output" () }; + bind "<ctrl>a" { "move-input-start" () }; } * { diff --git a/src/terminal.py b/src/terminal.py index 3d77a74..3e13757 100644 --- a/src/terminal.py +++ b/src/terminal.py @@ -79,6 +79,7 @@ class Terminal(Gtk.Window): def bind_custom_signals(self): signals = { "kill-after-output": self.kill_after_output, + "move-input-start": self.move_input_start, } for signal in signals.items(): @@ -127,3 +128,11 @@ class Terminal(Gtk.Window): end = buffer.get_end_iter() buffer.delete(start, end) + + def move_input_start(self, textview): + if self.last_output_mark is None: + return + buffer = textview.get_buffer() + + start = buffer.get_iter_at_mark(self.last_output_mark) + buffer.place_cursor(start) |