summaryrefslogtreecommitdiffstats
path: root/scene/gui/line_edit.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2022-01-13 09:21:01 +0100
committerGitHub <noreply@github.com>2022-01-13 09:21:01 +0100
commitf6792eacf58fcdfe40596980220fefe1ca2a93fc (patch)
treed0e2435baf1b7cc860e3d995efb34f833454af2b /scene/gui/line_edit.cpp
parent2d72dadbdefaa5e1bd74fce0e77c494a94fac599 (diff)
parentf6443beade093a1413e87c53fb9821e5e25c859f (diff)
downloadredot-engine-f6792eacf58fcdfe40596980220fefe1ca2a93fc.tar.gz
Merge pull request #54956 from Calinou/lineedit-textedit-add-caret-width-theme-item
Add a theme constant to change LineEdit and TextEdit's caret width
Diffstat (limited to 'scene/gui/line_edit.cpp')
-rw-r--r--scene/gui/line_edit.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index ec18101d2f..f7d6850a88 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -780,8 +780,6 @@ void LineEdit::_notification(int p_what) {
ofs_max -= r_icon->get_width();
}
- int caret_width = Math::round(1 * get_theme_default_base_scale());
-
// Draw selections rects.
Vector2 ofs = Point2(x_ofs + scroll_offset, y_ofs);
if (selection.enabled) {
@@ -843,6 +841,8 @@ void LineEdit::_notification(int p_what) {
// Draw carets.
ofs.x = x_ofs + scroll_offset;
if (draw_caret || drag_caret_force_displayed) {
+ const int caret_width = get_theme_constant(SNAME("caret_width")) * get_theme_default_base_scale();
+
if (ime_text.length() == 0) {
// Normal caret.
CaretInfo caret = TS->shaped_text_get_carets(text_rid, caret_column);