mirror of
https://github.com/lihop/godot-xterm.git
synced 2025-05-04 20:24:23 +02:00
Add clear and sb_reset
Clearing the terminal removes all lines in the scrollback buffer except for the most recent. With sb_reset, the terminal will return the scrollback buffer to the bottom when the user starts typing if they have previously scrolled up.
This commit is contained in:
parent
ebb527cb8b
commit
e8c27f2796
5 changed files with 40 additions and 12 deletions
|
@ -73,6 +73,13 @@ func write(data) -> void:
|
|||
_native_terminal.update()
|
||||
|
||||
|
||||
func clear() -> void:
|
||||
var initial_size = _native_terminal.rect_size
|
||||
_native_terminal.rect_size.y = _native_terminal.cell_size.y
|
||||
_native_terminal.clear_sb()
|
||||
_native_terminal.rect_size = initial_size
|
||||
|
||||
|
||||
func copy_selection() -> String:
|
||||
return _native_terminal.copy_selection()
|
||||
|
||||
|
@ -115,6 +122,10 @@ 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.
|
||||
|
||||
_handle_mouse_wheel(event)
|
||||
_handle_selection(event)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue