Prevent scrollback buffer reset when using copy shortcut

Prevents scrollback buffer reset (i.e. scrolling to the bottom of
terminal output) when pressing modifier keys in isolation or when
copying text using the shortcut Ctrl+Shift+C.
This commit is contained in:
Leroy Hopson 2022-06-27 00:41:24 +07:00
parent cf613708c4
commit b76f8d0939
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
2 changed files with 10 additions and 2 deletions

View file

@ -175,8 +175,14 @@ func _refresh():
func _gui_input(event):
_native_terminal._gui_input(event)
if event is InputEventKey:
_native_terminal.sb_reset() # Return to bottom of scrollback buffer if we scrolled up.
if event is InputEventKey and event.pressed:
# Return to bottom of scrollback buffer if we scrolled up. Ignore modifier
# keys pressed in isolation or if Ctrl+Shift modifier keys are pressed.
if (
not event.scancode in [KEY_ALT, KEY_SHIFT, KEY_CONTROL, KEY_META, KEY_MASK_CMD]
and not (event.control and event.shift)
):
_native_terminal.sb_reset()
_handle_mouse_wheel(event)
_handle_selection(event)