Selaa lähdekoodia

Support UTF-8 in TextEdit and LineEdit navigation

This allows jumps over whole non ASCII words with Ctrl+Left/Right in
a LineEdit or TextEdit.
Fixes #25681
Paul Trojahn 6 vuotta sitten
vanhempi
commit
8851e16f75
2 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 1 1
      scene/gui/line_edit.cpp
  2. 1 1
      scene/gui/text_edit.cpp

+ 1 - 1
scene/gui/line_edit.cpp

@@ -43,7 +43,7 @@
 
 
 static bool _is_text_char(CharType c) {
 static bool _is_text_char(CharType c) {
 
 
-	return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_';
+	return !is_symbol(c);
 }
 }
 
 
 void LineEdit::_gui_input(Ref<InputEvent> p_event) {
 void LineEdit::_gui_input(Ref<InputEvent> p_event) {

+ 1 - 1
scene/gui/text_edit.cpp

@@ -50,7 +50,7 @@ inline bool _is_symbol(CharType c) {
 
 
 static bool _is_text_char(CharType c) {
 static bool _is_text_char(CharType c) {
 
 
-	return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_';
+	return !is_symbol(c);
 }
 }
 
 
 static bool _is_whitespace(CharType c) {
 static bool _is_whitespace(CharType c) {