Browse Source

Merge pull request #31792 from Calinou/spinbox-expression-ignore-prefix-suffix

Ignore the prefix and suffix in the SpinBox expression
Rémi Verschelde 6 years ago
parent
commit
efbd2bbf18
1 changed files with 2 additions and 1 deletions
  1. 2 1
      scene/gui/spin_box.cpp

+ 2 - 1
scene/gui/spin_box.cpp

@@ -53,7 +53,8 @@ void SpinBox::_text_entered(const String &p_string) {
 
 	Ref<Expression> expr;
 	expr.instance();
-	Error err = expr->parse(p_string);
+	// Ignore the prefix and suffix in the expression
+	Error err = expr->parse(p_string.trim_prefix(prefix + " ").trim_suffix(" " + suffix));
 	if (err != OK) {
 		return;
 	}