You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm building a custom text editor to write code with custom extensions.
Describe the problem or limitation you are having in your project
I try to get the current text that the user input and check if it matches anything keyword I defined. If matched, it will trigger the auto-completion and give a list for users to choose from. I search a bit and found that there are two functions that might suit my need in Godot 4. One is get_word_at_pos() and the other is get_word_under_caret(). get_word_at_pos() works great only does not support symbol and get_word_under_caret() need a bit workaround and I found it support $ and ~ but still not for all. So I was stuck with no way to get the full string that the user input with symbols.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Allow the get_word_at_pos() function to support symbols so any kind of custom code using symbols very often can use it more effectively.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
See godotengine/godot#46721. You should be able to override word break characters with an empty list when adding text to the TextEdit node to control the behavior of get_word_at_pos() and get_word_under_caret().
Describe the project you are working on
I'm building a custom text editor to write code with custom extensions.
Describe the problem or limitation you are having in your project
I try to get the current text that the user input and check if it matches anything keyword I defined. If matched, it will trigger the auto-completion and give a list for users to choose from. I search a bit and found that there are two functions that might suit my need in Godot 4. One is
get_word_at_pos()
and the other isget_word_under_caret()
.get_word_at_pos()
works great only does not support symbol andget_word_under_caret()
need a bit workaround and I found it support$
and~
but still not for all. So I was stuck with no way to get the full string that the user input with symbols.Describe the feature / enhancement and how it helps to overcome the problem or limitation
Allow the
get_word_at_pos()
function to support symbols so any kind of custom code using symbols very often can use it more effectively.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Code:
In extEdit when user input:
===Test Code===@#$
Console will print full of them:
Current input text: ===Test Code===@#$
If this enhancement will not be used often, can it be worked around with a few lines of script?
I didn't find any other way to do this at this moment.
Is there a reason why this should be core and not an add-on in the asset library?
TextEdit node is for building custom edit environments and more customizable for different situations will be more useful.
The text was updated successfully, but these errors were encountered: