summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-10-30 23:31:37 +0100
committerGitHub <noreply@github.com>2017-10-30 23:31:37 +0100
commit5bbc9a7e663c7119a0089cdc853d4b97b2ce6280 (patch)
treea097d00fc1cba0f8e390ce5f48d6a3454c63fb4f /scene/gui
parent4e753971c3ff14398f93cddbd1a683bbebad931e (diff)
parentd46093b9742bbd063caa6b2636be5238b7da1218 (diff)
Merge pull request #12268 from AlexHolly/fix-lineedit-selection
Fix LineEdit drag selection to the left
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/line_edit.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index f57f58c18d..40e2dba6c2 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -1038,9 +1038,11 @@ void LineEdit::set_cursor_position(int p_pos) {
Ref<StyleBox> style = get_stylebox("normal");
Ref<Font> font = get_font("font");
- if (cursor_pos < window_pos) {
+ if (cursor_pos <= window_pos) {
/* Adjust window if cursor goes too much to the left */
- set_window_pos(cursor_pos);
+ if (window_pos > 0)
+ set_window_pos(window_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;