Skip to content

Commit 67f80aa

Browse files
committed
[LineEdit] Fix double click not selecting single character words.
1 parent ca45211 commit 67f80aa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scene/gui/line_edit.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ void LineEdit::gui_input(const Ref<InputEvent> &p_event) {
503503
last_dblclk_pos = b->get_position();
504504
PackedInt32Array words = TS->shaped_text_get_word_breaks(text_rid);
505505
for (int i = 0; i < words.size(); i = i + 2) {
506-
if ((words[i] < caret_column && words[i + 1] > caret_column) || (i == words.size() - 2 && caret_column == words[i + 1])) {
506+
if (words[i] <= caret_column && words[i + 1] >= caret_column) {
507507
selection.enabled = true;
508508
selection.begin = words[i];
509509
selection.end = words[i + 1];
@@ -597,10 +597,10 @@ void LineEdit::gui_input(const Ref<InputEvent> &p_event) {
597597

598598
PackedInt32Array words = TS->shaped_text_get_word_breaks(text_rid);
599599
for (int i = 0; i < words.size(); i = i + 2) {
600-
if ((words[i] < selection.begin && words[i + 1] > selection.begin) || (i == words.size() - 2 && selection.begin == words[i + 1])) {
600+
if (words[i] <= selection.begin && words[i + 1] >= selection.begin) {
601601
selection.begin = words[i];
602602
}
603-
if ((words[i] < selection.end && words[i + 1] > selection.end) || (i == words.size() - 2 && selection.end == words[i + 1])) {
603+
if (words[i] <= selection.end && words[i + 1] >= selection.end) {
604604
selection.end = words[i + 1];
605605
selection.enabled = true;
606606
break;

0 commit comments

Comments
 (0)