Browse Source

[3.x] Expose get_selected_text in RichTextLabel

ConteZero 3 years ago
parent
commit
820728aa52
2 changed files with 7 additions and 0 deletions
  1. 6 0
      doc/classes/RichTextLabel.xml
  2. 1 0
      scene/gui/rich_text_label.cpp

+ 6 - 0
doc/classes/RichTextLabel.xml

@@ -66,6 +66,12 @@
 				Returns the total number of newlines in the tag stack's text tags. Considers wrapped text as one line.
 				Returns the total number of newlines in the tag stack's text tags. Considers wrapped text as one line.
 			</description>
 			</description>
 		</method>
 		</method>
+		<method name="get_selected_text">
+			<return type="String" />
+			<description>
+				Returns the current selection text. Does not include BBCodes.
+			</description>
+		</method>
 		<method name="get_total_character_count" qualifiers="const">
 		<method name="get_total_character_count" qualifiers="const">
 			<return type="int" />
 			<return type="int" />
 			<description>
 			<description>

+ 1 - 0
scene/gui/rich_text_label.cpp

@@ -2815,6 +2815,7 @@ void RichTextLabel::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("pop"), &RichTextLabel::pop);
 	ClassDB::bind_method(D_METHOD("pop"), &RichTextLabel::pop);
 
 
 	ClassDB::bind_method(D_METHOD("clear"), &RichTextLabel::clear);
 	ClassDB::bind_method(D_METHOD("clear"), &RichTextLabel::clear);
+	ClassDB::bind_method(D_METHOD("get_selected_text"), &RichTextLabel::get_selected_text);
 	ClassDB::bind_method(D_METHOD("deselect"), &RichTextLabel::deselect);
 	ClassDB::bind_method(D_METHOD("deselect"), &RichTextLabel::deselect);
 
 
 	ClassDB::bind_method(D_METHOD("set_meta_underline", "enable"), &RichTextLabel::set_meta_underline);
 	ClassDB::bind_method(D_METHOD("set_meta_underline", "enable"), &RichTextLabel::set_meta_underline);