summaryrefslogtreecommitdiff
path: root/scene/gui/rich_text_label.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/rich_text_label.cpp')
-rw-r--r--scene/gui/rich_text_label.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 6fbc58a38a..7fe8a01cda 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -815,7 +815,35 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
}
}
}
+ } else if (b->is_pressed() && b->is_doubleclick() && selection.enabled) {
+ //doubleclick: select word
+ int line = 0;
+ Item *item = NULL;
+ bool outside;
+
+ _find_click(main, b->get_position(), &item, &line, &outside);
+
+ while (item && item->type != ITEM_TEXT) {
+
+ item = _get_next_item(item, true);
+ }
+
+ if (item && item->type == ITEM_TEXT) {
+
+ String itext = static_cast<ItemText *>(item)->text;
+
+ int beg, end;
+ if (select_word(itext, line, beg, end)) {
+
+ selection.from = item;
+ selection.to = item;
+ selection.from_char = beg;
+ selection.to_char = end - 1;
+ selection.active = true;
+ update();
+ }
+ }
} else if (!b->is_pressed()) {
selection.click = NULL;