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:
Leroy Hopson 2021-07-13 22:20:29 +07:00
parent 703eb68f11
commit 97e07093b2
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
4 changed files with 14 additions and 2 deletions

View file

@ -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;
}

View file

@ -64,6 +64,7 @@ public:
void select_to_pointer(Vector2 position);
void reset_selection();
String copy_selection();
String copy_all();
enum UpdateMode {
DISABLED,