summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-02-20 10:56:13 +0100
committerGitHub <noreply@github.com>2019-02-20 10:56:13 +0100
commitf41439c84b206067adeea9c97eaf87fb264ee682 (patch)
treef1075c510866e794a5828b9a1384b01e556faccf
parent3c70a4a83a584da1a8d0248a766b0211a8cc17f9 (diff)
parent86374c04314ae8af81e66955370bec7a37ff7114 (diff)
Merge pull request #26073 from karliss/line-edit-home
Allow moving LineEdit visible window left by more than one symbol.
-rw-r--r--scene/gui/line_edit.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 4a2bb3dad1..bf6833e512 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -1154,9 +1154,7 @@ void LineEdit::set_cursor_position(int p_pos) {
if (cursor_pos <= window_pos) {
/* Adjust window if cursor goes too much to the left */
- if (window_pos > 0)
- set_window_pos(window_pos - 1);
-
+ set_window_pos(MAX(0, cursor_pos - 1));
} else if (cursor_pos > window_pos) {
/* Adjust window if cursor goes too much to the right */
int window_width = get_size().width - style->get_minimum_size().width;