From 9a1ce8e6c32534c3452f80d0245935498d97af66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 6 Jul 2021 12:49:27 +0200 Subject: LineEdit: Respect `max_length` by truncating text to append When appending text (either via `set_text()` or by pasting from clipboard), if the input would make the `LineEdit` exceed its configured `max_length`, the input text is truncated to fit. The discard part is passed as a parameter in the `text_change_rejected` signal. Fixes #33321. Fixes #41278. Also cleaned up unimplemented `max_chars` property in `TextEdit`. Co-authored-by: Tony-Goat <70238376+Tony-Goat@users.noreply.github.com> --- scene/gui/text_edit.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'scene/gui/text_edit.h') diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 146de50275..dcd5c6d0f8 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -258,7 +258,6 @@ private: uint32_t version = 0; uint32_t saved_version = 0; - int max_chars = 0; bool readonly = true; // Initialise to opposite first, so we get past the early-out in set_readonly. Timer *caret_blink_timer; @@ -678,9 +677,6 @@ public: void set_readonly(bool p_readonly); bool is_readonly() const; - void set_max_chars(int p_max_chars); - int get_max_chars() const; - void set_wrap_enabled(bool p_wrap_enabled); bool is_wrap_enabled() const; bool line_wraps(int line) const; -- cgit v1.2.3