diff options
author | Kārlis Seņko <karlis3p70l1ij@gmail.com> | 2019-02-19 23:59:09 +0200 |
---|---|---|
committer | Kārlis Seņko <karlis3p70l1ij@gmail.com> | 2019-02-19 23:59:09 +0200 |
commit | 86374c04314ae8af81e66955370bec7a37ff7114 (patch) | |
tree | 803e58e93d214290fa67a70218b5d2ca3ac85b8f /scene | |
parent | aa5b99821b23d74eafb49f4b0d2d86fe693a903c (diff) |
Allow moving LineEdit visible window left by more than one symbol.
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/line_edit.cpp | 4 |
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; |