fix(term): select() fixes

- Ensure selection is drawn.
- Allow deselection by mouse click.
- Respect copy_on_selection attribute.
This commit is contained in:
Leroy Hopson 2024-05-05 17:02:18 +12:00
parent 77b1481f8e
commit e1563a5345
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA

View file

@ -739,6 +739,18 @@ void Terminal::select(const int p_from_line, const int p_from_column, const int
tsm_screen_selection_reset(screen);
tsm_screen_selection_start(screen, from_column, from_line);
tsm_screen_selection_target(screen, to_column, to_line);
String selection = copy_selection();
#if defined(__linux__)
if (copy_on_selection)
DisplayServer::get_singleton()->clipboard_set_primary(selection);
#endif
if (selection.length() > 0) {
selecting = true;
queue_redraw();
}
}
String Terminal::copy_all() {