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:
Leroy Hopson 2021-07-13 06:27:20 +07:00
parent ebb527cb8b
commit e8c27f2796
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
5 changed files with 40 additions and 12 deletions

View file

@ -161,14 +161,17 @@ func _on_TerminalPopupMenu_id_pressed(id):
match id:
TerminalPopupMenuOptions.NEW_TERMINAL:
_on_AddButton_pressed()
TerminalPopupMenuOptions.PASTE:
if tabs.get_tab_count() > 0:
var terminal = tab_container.get_child(tab_container.current_tab)
if tabs.get_tab_count() > 0:
var terminal = tab_container.get_child(tab_container.current_tab)
match id:
TerminalPopupMenuOptions.PASTE:
for i in OS.clipboard.length():
var event = InputEventKey.new()
event.unicode = ord(OS.clipboard[i])
event.pressed = true
terminal._gui_input(event)
TerminalPopupMenuOptions.KILL_TERMINAL:
if tabs.get_tab_count() > 0:
TerminalPopupMenuOptions.CLEAR:
terminal.clear()
TerminalPopupMenuOptions.KILL_TERMINAL:
_on_Tabs_tab_close(tabs.current_tab)