From f7a7ecc10ae6f8f0590651d836e1169c6034087f Mon Sep 17 00:00:00 2001 From: MewPurPur Date: Thu, 19 Sep 2024 01:15:12 +0300 Subject: [PATCH] Expose has_undo() and has_redo() of LineEdit --- doc/classes/LineEdit.xml | 12 ++++++++++++ scene/gui/line_edit.cpp | 2 ++ 2 files changed, 14 insertions(+) diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml index d218f720a38..9c460e6d62b 100644 --- a/doc/classes/LineEdit.xml +++ b/doc/classes/LineEdit.xml @@ -151,12 +151,24 @@ Returns [code]true[/code] if the user has text in the [url=https://en.wikipedia.org/wiki/Input_method]Input Method Editor[/url] (IME). + + + + Returns [code]true[/code] if a "redo" action is available. + + Returns [code]true[/code] if the user has selected text. + + + + Returns [code]true[/code] if an "undo" action is available. + + diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index a08fb96e71d..756cb77c60d 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -2763,6 +2763,8 @@ void LineEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("select", "from", "to"), &LineEdit::select, DEFVAL(0), DEFVAL(-1)); ClassDB::bind_method(D_METHOD("select_all"), &LineEdit::select_all); ClassDB::bind_method(D_METHOD("deselect"), &LineEdit::deselect); + ClassDB::bind_method(D_METHOD("has_undo"), &LineEdit::has_undo); + ClassDB::bind_method(D_METHOD("has_redo"), &LineEdit::has_redo); ClassDB::bind_method(D_METHOD("has_selection"), &LineEdit::has_selection); ClassDB::bind_method(D_METHOD("get_selected_text"), &LineEdit::get_selected_text); ClassDB::bind_method(D_METHOD("get_selection_from_column"), &LineEdit::get_selection_from_column);