diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-06-11 09:33:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-11 09:33:27 +0200 |
commit | fcf14da8d0e5398e10d8cae5ac8394788c716a31 (patch) | |
tree | 63f9bcbdb060493ebe1b9cd5ddeed82b139ef6f1 /scene/gui | |
parent | 2dae762e533145fdea1b34f3897f1b8c2949c9d9 (diff) | |
parent | 2bb44ea5bd57ddaeb7ede96f13736767e4b30342 (diff) |
Merge pull request #39337 from Cevantime/add-text-deletion-methods-to-line-edit
Make text deletion methods public for LineEdit
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/line_edit.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index fbacb3ed9e..ee6783167a 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -1211,6 +1211,8 @@ void LineEdit::delete_char() { } void LineEdit::delete_text(int p_from_column, int p_to_column) { + ERR_FAIL_COND_MSG(p_from_column < 0 || p_from_column > p_to_column || p_to_column > text.length(), + vformat("Positional parameters (from: %d, to: %d) are inverted or outside the text length (%d).", p_from_column, p_to_column, text.length())); if (text.size() > 0) { Ref<Font> font = get_theme_font("font"); if (font != nullptr) { @@ -1783,6 +1785,8 @@ void LineEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("set_max_length", "chars"), &LineEdit::set_max_length); ClassDB::bind_method(D_METHOD("get_max_length"), &LineEdit::get_max_length); ClassDB::bind_method(D_METHOD("append_at_cursor", "text"), &LineEdit::append_at_cursor); + ClassDB::bind_method(D_METHOD("delete_char_at_cursor"), &LineEdit::delete_char); + ClassDB::bind_method(D_METHOD("delete_text", "from_column", "to_column"), &LineEdit::delete_text); ClassDB::bind_method(D_METHOD("set_editable", "enabled"), &LineEdit::set_editable); ClassDB::bind_method(D_METHOD("is_editable"), &LineEdit::is_editable); ClassDB::bind_method(D_METHOD("set_secret", "enabled"), &LineEdit::set_secret); |