mirror of
https://github.com/lihop/godot-xterm.git
synced 2024-11-22 01:30:25 +01:00
Change terminal menu option 'Select All' -> 'Copy All'
Adds copy_all() function to terminal node which returns all of the screen's text.
This commit is contained in:
parent
703eb68f11
commit
97e07093b2
4 changed files with 14 additions and 2 deletions
|
@ -16,7 +16,7 @@ enum TerminalPopupMenuOptions {
|
|||
NEW_TERMINAL = 0,
|
||||
COPY = 2,
|
||||
PASTE = 3,
|
||||
SELECT_ALL = 4,
|
||||
COPY_ALL = 4,
|
||||
CLEAR = 6,
|
||||
KILL_TERMINAL = 7,
|
||||
}
|
||||
|
@ -216,6 +216,8 @@ func _on_TerminalPopupMenu_id_pressed(id):
|
|||
event.unicode = ord(OS.clipboard[i])
|
||||
event.pressed = true
|
||||
terminal._gui_input(event)
|
||||
TerminalPopupMenuOptions.COPY_ALL:
|
||||
OS.clipboard = terminal.copy_all()
|
||||
TerminalPopupMenuOptions.CLEAR:
|
||||
terminal.clear()
|
||||
TerminalPopupMenuOptions.KILL_TERMINAL:
|
||||
|
|
|
@ -107,7 +107,7 @@ margin_right = 193.0
|
|||
margin_bottom = 160.0
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
items = [ "New Terminal", null, 0, false, false, 0, 0, null, "", false, "", null, 0, false, true, 1, 0, null, "", true, "Copy", null, 0, false, false, 2, 0, null, "", false, "Paste", null, 0, false, false, 3, 0, null, "", false, "Select All", null, 0, false, true, 4, 0, null, "", false, "", null, 0, false, false, 5, 0, null, "", true, "Clear", null, 0, false, false, 6, 0, null, "", false, "Kill Terminal", null, 0, false, false, 7, 0, null, "", false ]
|
||||
items = [ "New Terminal", null, 0, false, false, 0, 0, null, "", false, "", null, 0, false, true, 1, 0, null, "", true, "Copy", null, 0, false, false, 2, 0, null, "", false, "Paste", null, 0, false, false, 3, 0, null, "", false, "Copy All", null, 0, false, false, 4, 0, null, "", false, "", null, 0, false, false, 5, 0, null, "", true, "Clear", null, 0, false, false, 6, 0, null, "", false, "Kill Terminal", null, 0, false, false, 7, 0, null, "", false ]
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
|
|
@ -295,6 +295,7 @@ void Terminal::_register_methods() {
|
|||
register_method("select_to_pointer", &Terminal::select_to_pointer);
|
||||
register_method("reset_selection", &Terminal::reset_selection);
|
||||
register_method("copy_selection", &Terminal::copy_selection);
|
||||
register_method("copy_all", &Terminal::copy_all);
|
||||
|
||||
register_method("_update_theme", &Terminal::update_theme);
|
||||
register_method("_update_size", &Terminal::update_theme);
|
||||
|
@ -626,3 +627,11 @@ String Terminal::copy_selection() {
|
|||
std::free(out);
|
||||
return result;
|
||||
}
|
||||
|
||||
String Terminal::copy_all() {
|
||||
char *out = nullptr;
|
||||
int len = tsm_screen_copy_all(screen, &out);
|
||||
String result = String(out);
|
||||
std::free(out);
|
||||
return result;
|
||||
}
|
|
@ -64,6 +64,7 @@ public:
|
|||
void select_to_pointer(Vector2 position);
|
||||
void reset_selection();
|
||||
String copy_selection();
|
||||
String copy_all();
|
||||
|
||||
enum UpdateMode {
|
||||
DISABLED,
|
||||
|
|
Loading…
Reference in a new issue