Merge pull request #14353 from TheAspiringHacker/fix-lineedit-eat

Check for icon in LineEdit::set_cursor_position
This commit is contained in:
Rémi Verschelde 2017-12-07 07:38:26 +01:00 committed by GitHub
commit f13bea768d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1046,6 +1046,10 @@ void LineEdit::set_cursor_position(int p_pos) {
} else if (cursor_pos > window_pos) { } else if (cursor_pos > window_pos) {
/* Adjust window if cursor goes too much to the right */ /* Adjust window if cursor goes too much to the right */
int window_width = get_size().width - style->get_minimum_size().width; int window_width = get_size().width - style->get_minimum_size().width;
if (has_icon("right_icon")) {
Ref<Texture> r_icon = Control::get_icon("right_icon");
window_width -= r_icon->get_width();
}
if (window_width < 0) if (window_width < 0)
return; return;