You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Fixed offset view when removing text, issue 10529
This commit is contained in:
@@ -3190,6 +3190,11 @@ void TextEdit::adjust_viewport_to_cursor() {
|
|||||||
if (cursor.line < cursor.line_ofs)
|
if (cursor.line < cursor.line_ofs)
|
||||||
cursor.line_ofs = cursor.line;
|
cursor.line_ofs = cursor.line;
|
||||||
|
|
||||||
|
if (cursor.line_ofs + visible_rows > text.size() && !scroll_past_end_of_file_enabled) {
|
||||||
|
cursor.line_ofs = text.size() - visible_rows;
|
||||||
|
v_scroll->set_value(text.size() - visible_rows);
|
||||||
|
}
|
||||||
|
|
||||||
int cursor_x = get_column_x_offset(cursor.column, text[cursor.line]);
|
int cursor_x = get_column_x_offset(cursor.column, text[cursor.line]);
|
||||||
|
|
||||||
if (cursor_x > (cursor.x_ofs + visible_width))
|
if (cursor_x > (cursor.x_ofs + visible_width))
|
||||||
@@ -3662,10 +3667,10 @@ void TextEdit::cut() {
|
|||||||
String clipboard = _base_get_text(selection.from_line, selection.from_column, selection.to_line, selection.to_column);
|
String clipboard = _base_get_text(selection.from_line, selection.from_column, selection.to_line, selection.to_column);
|
||||||
OS::get_singleton()->set_clipboard(clipboard);
|
OS::get_singleton()->set_clipboard(clipboard);
|
||||||
|
|
||||||
cursor_set_line(selection.from_line);
|
_remove_text(selection.from_line, selection.from_column, selection.to_line, selection.to_column);
|
||||||
|
cursor_set_line(selection.from_line); // set afterwards else it causes the view to be offset
|
||||||
cursor_set_column(selection.from_column);
|
cursor_set_column(selection.from_column);
|
||||||
|
|
||||||
_remove_text(selection.from_line, selection.from_column, selection.to_line, selection.to_column);
|
|
||||||
selection.active = false;
|
selection.active = false;
|
||||||
selection.selecting_mode = Selection::MODE_NONE;
|
selection.selecting_mode = Selection::MODE_NONE;
|
||||||
update();
|
update();
|
||||||
|
|||||||
Reference in New Issue
Block a user