Fix connect signal dialog not allowing Unicode method name

(cherry picked from commit 936c9e83b4)
This commit is contained in:
Haoyu Qiu 2023-04-08 16:31:25 +08:00 committed by Yuri Sizov
parent deb22e2381
commit d0c50d820b
1 changed files with 2 additions and 2 deletions

View File

@ -119,7 +119,7 @@ void ConnectDialog::ok_pressed() {
return; return;
} }
if (!method_name.strip_edges().is_valid_identifier()) { if (!TS->is_valid_identifier(method_name.strip_edges())) {
error->set_text(TTR("Method name must be a valid identifier.")); error->set_text(TTR("Method name must be a valid identifier."));
error->popup_centered(); error->popup_centered();
return; return;
@ -228,7 +228,7 @@ StringName ConnectDialog::generate_method_callback_name(Node *p_source, String p
String node_name = p_source->get_name(); String node_name = p_source->get_name();
for (int i = 0; i < node_name.length(); i++) { // TODO: Regex filter may be cleaner. for (int i = 0; i < node_name.length(); i++) { // TODO: Regex filter may be cleaner.
char32_t c = node_name[i]; char32_t c = node_name[i];
if (!is_ascii_identifier_char(c)) { if ((i == 0 && !is_unicode_identifier_start(c)) || (i > 0 && !is_unicode_identifier_continue(c))) {
if (c == ' ') { if (c == ' ') {
// Replace spaces with underlines. // Replace spaces with underlines.
c = '_'; c = '_';