From d46093b9742bbd063caa6b2636be5238b7da1218 Mon Sep 17 00:00:00 2001 From: AlexHolly Date: Fri, 20 Oct 2017 21:24:41 +0200 Subject: fix LineEdit drag selection to the left --- scene/gui/line_edit.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index ed8eff436c..56ec791a1a 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -1036,9 +1036,11 @@ void LineEdit::set_cursor_position(int p_pos) { Ref style = get_stylebox("normal"); Ref 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; -- cgit v1.2.3