mirror of
https://github.com/lihop/godot-xterm.git
synced 2025-05-04 12:14:24 +02:00
Add copy selection support
This commit is contained in:
parent
57c1c3524d
commit
0e6334db96
5 changed files with 18 additions and 1 deletions
|
@ -289,6 +289,7 @@ void Terminal::_register_methods() {
|
|||
register_method("start_selection", &Terminal::start_selection);
|
||||
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("_update_theme", &Terminal::update_theme);
|
||||
register_method("_update_size", &Terminal::update_theme);
|
||||
|
@ -597,4 +598,12 @@ void Terminal::select_to_pointer(Vector2 position) {
|
|||
void Terminal::reset_selection() {
|
||||
tsm_screen_selection_reset(screen);
|
||||
update();
|
||||
}
|
||||
|
||||
String Terminal::copy_selection() {
|
||||
char *out = nullptr;
|
||||
int len = tsm_screen_selection_copy(screen, &out);
|
||||
String result = String(out);
|
||||
std::free(out);
|
||||
return result;
|
||||
}
|
|
@ -61,6 +61,7 @@ public:
|
|||
void start_selection(Vector2 position);
|
||||
void select_to_pointer(Vector2 position);
|
||||
void reset_selection();
|
||||
String copy_selection();
|
||||
|
||||
enum UpdateMode {
|
||||
DISABLED,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue