浏览代码

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

Check for icon in LineEdit::set_cursor_position
Rémi Verschelde 7 年之前
父节点
当前提交
f13bea768d
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      scene/gui/line_edit.cpp

+ 4 - 0
scene/gui/line_edit.cpp

@@ -1046,6 +1046,10 @@ void LineEdit::set_cursor_position(int p_pos) {
 	} 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;
+		if (has_icon("right_icon")) {
+			Ref<Texture> r_icon = Control::get_icon("right_icon");
+			window_width -= r_icon->get_width();
+		}
 
 		if (window_width < 0)
 			return;