From f6576147607f15888b8f67fd2993a676121f73c2 Mon Sep 17 00:00:00 2001 From: Darren Kaste Date: Mon, 16 Mar 2020 12:22:13 -0400 Subject: [PATCH] Calculate LineEdit selection with secret character (cherry picked from commit 395a038c85ee0b99045a6edf467f482aa7106c71) --- scene/gui/line_edit.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 7cc47d351e3..073ffd2fd8a 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -1066,7 +1066,11 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) { int char_w = 0; if (font != NULL) { - char_w = font->get_char_size(text[ofs]).width; + if (is_secret()) { + char_w = font->get_char_size(secret_character[0]).width; + } else { + char_w = font->get_char_size(text[ofs]).width; + } } pixel_ofs += char_w;