Updated LineEdit to address #41278
Updated set_max_length() function to actually pull a substring of the current text so it's not all thrown away when the new max length is shorter than the current length.
(cherry picked from commit 71febfd6e2
)
This commit is contained in:
parent
63b2f69c7f
commit
1b6d116dfb
|
@ -1263,7 +1263,12 @@ void LineEdit::delete_text(int p_from_column, int p_to_column) {
|
||||||
void LineEdit::set_text(String p_text) {
|
void LineEdit::set_text(String p_text) {
|
||||||
|
|
||||||
clear_internal();
|
clear_internal();
|
||||||
append_at_cursor(p_text);
|
|
||||||
|
if (p_text.length() > max_length) {
|
||||||
|
append_at_cursor(p_text.substr(0, max_length));
|
||||||
|
} else {
|
||||||
|
append_at_cursor(p_text);
|
||||||
|
}
|
||||||
|
|
||||||
if (expand_to_text_length) {
|
if (expand_to_text_length) {
|
||||||
minimum_size_changed();
|
minimum_size_changed();
|
||||||
|
|
Loading…
Reference in New Issue