-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LineEdit: Now double click to select a word, and triple click to sele… #46524
Conversation
scene/gui/line_edit.cpp
Outdated
bool symbol = beg < text.length() && is_symbol(text[beg]); | ||
|
||
while (beg > 0 && text[beg - 1] > 32 && (symbol == is_symbol(text[beg - 1]))) { | ||
beg--; | ||
} | ||
while (end < text.length() && text[end + 1] > 32 && (symbol == is_symbol(text[end + 1]))) { | ||
end++; | ||
} | ||
if (end < text.length()) { | ||
end += 1; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use Vector<Vector2i> words = TS->shaped_text_get_word_breaks(text_rid);
instead of is_symbol
and > 32
to correctly detect words in the languages which do not use spaces, see _move_cursor_left
, _move_cursor_right
functions for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the current approach is fine for 3.2 version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I will update this PR doing that on LineEdit
and TextEdit
and open a new PR with this code for 3.2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
61d197f
to
9ab60fe
Compare
…ct all the content using the new TextServer TextEdit: Update the method to search words with the new TextServer
9ab60fe
to
a3db2fd
Compare
Thanks! |
@kuruk-mm Thanks for the contribution! |
Ah yeah, I had the same issue. This is quite annoying. |
…ct all the content
Fix #46259
I used the code from
TextEdit
to make this one.