summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-01-10 09:37:39 +0100
committerGitHub <noreply@github.com>2020-01-10 09:37:39 +0100
commit65446a1303a519035afffde3fc278bb50d2a70d8 (patch)
tree64f06be6f98f8b1303732aad3b3243b092bf1aa5 /editor
parent4bad292f20a8592a0cc902949f023bb7d9b3cfb3 (diff)
parent715c0f9dfd3b66a96121b9233c8db39f587141c1 (diff)
Merge pull request #34981 from timothyqiu/trim-group-name
Trims user provided group name
Diffstat (limited to 'editor')
-rw-r--r--editor/groups_editor.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp
index c19bee321a..83259afb35 100644
--- a/editor/groups_editor.cpp
+++ b/editor/groups_editor.cpp
@@ -215,7 +215,7 @@ void GroupDialog::_group_renamed() {
return;
}
- String name = renamed_group->get_text(0).strip_edges();
+ const String name = renamed_group->get_text(0).strip_edges();
for (TreeItem *E = groups_root->get_children(); E; E = E->get_next()) {
if (E != renamed_group && E->get_text(0) == name) {
renamed_group->set_text(0, selected_group);
@@ -232,6 +232,8 @@ void GroupDialog::_group_renamed() {
return;
}
+ renamed_group->set_text(0, name); // Spaces trimmed.
+
undo_redo->create_action(TTR("Rename Group"));
List<Node *> nodes;
@@ -254,8 +256,8 @@ void GroupDialog::_group_renamed() {
undo_redo->add_undo_method(this, "_delete_group_item", selected_group);
}
- undo_redo->add_do_method(this, "_rename_group_item", selected_group, renamed_group->get_text(0));
- undo_redo->add_undo_method(this, "_rename_group_item", renamed_group->get_text(0), selected_group);
+ undo_redo->add_do_method(this, "_rename_group_item", selected_group, name);
+ undo_redo->add_undo_method(this, "_rename_group_item", name, selected_group);
undo_redo->add_do_method(this, "_group_selected");
undo_redo->add_undo_method(this, "_group_selected");
undo_redo->add_do_method(this, "emit_signal", "group_edited");
@@ -550,8 +552,8 @@ void GroupsEditor::_add_group(const String &p_group) {
if (!node)
return;
- String name = group_name->get_text();
- if (name.strip_edges() == "")
+ const String name = group_name->get_text().strip_edges();
+ if (name.empty())
return;
if (node->is_in_group(name))