File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed
Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -2821,7 +2821,10 @@ void RichTextLabel::gui_input(const Ref<InputEvent> &p_event) {
28212821 handled = true ;
28222822 }
28232823 if (k->is_action (" ui_copy" , true )) {
2824- selection_copy ();
2824+ const String txt = get_selected_text ();
2825+ if (!txt.is_empty ()) {
2826+ DisplayServer::get_singleton ()->clipboard_set (txt);
2827+ }
28252828 handled = true ;
28262829 }
28272830 }
@@ -6634,14 +6637,6 @@ void RichTextLabel::deselect() {
66346637 queue_redraw ();
66356638}
66366639
6637- void RichTextLabel::selection_copy () {
6638- String txt = get_selected_text ();
6639-
6640- if (!txt.is_empty ()) {
6641- DisplayServer::get_singleton ()->clipboard_set (txt);
6642- }
6643- }
6644-
66456640void RichTextLabel::select_all () {
66466641 _validate_line_caches ();
66476642
@@ -7618,7 +7613,14 @@ Key RichTextLabel::_get_menu_action_accelerator(const String &p_action) {
76187613void RichTextLabel::menu_option (int p_option) {
76197614 switch (p_option) {
76207615 case MENU_COPY: {
7621- selection_copy ();
7616+ String txt = get_selected_text ();
7617+ if (txt.is_empty ()) {
7618+ txt = get_parsed_text ();
7619+ }
7620+
7621+ if (!txt.is_empty ()) {
7622+ DisplayServer::get_singleton ()->clipboard_set (txt);
7623+ }
76227624 } break ;
76237625 case MENU_SELECT_ALL: {
76247626 select_all ();
Original file line number Diff line number Diff line change @@ -866,7 +866,6 @@ class RichTextLabel : public Control {
866866 float get_selection_line_offset () const ;
867867 String get_selected_text () const ;
868868 void select_all ();
869- void selection_copy ();
870869
871870 _FORCE_INLINE_ void set_selection_modifier (const Callable &p_modifier) {
872871 selection_modifier = p_modifier;
You can’t perform that action at this time.
0 commit comments