mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Merge pull request #113390 from X1Vi/text-edit-does-not-auto-scroll-113290
Fix `TextEdit` does not auto scroll properly on certain vertical sizes
This commit is contained in:
@@ -6584,7 +6584,7 @@ void TextEdit::set_line_as_last_visible(int p_line, int p_wrap_index) {
|
||||
set_v_scroll(0);
|
||||
return;
|
||||
}
|
||||
set_v_scroll(Math::round(get_scroll_pos_for_line(first_line, next_line.y) + _get_visible_lines_offset()));
|
||||
set_v_scroll(get_scroll_pos_for_line(first_line, next_line.y) + _get_visible_lines_offset());
|
||||
}
|
||||
|
||||
int TextEdit::get_last_full_visible_line() const {
|
||||
@@ -8613,9 +8613,12 @@ void TextEdit::_update_scrollbars() {
|
||||
updating_scrolls = true;
|
||||
|
||||
if (!fit_content_height && total_rows > visible_rows) {
|
||||
double visible_rows_exact = (double)_get_control_height() / (double)get_line_height();
|
||||
double fractional_visible_rows = visible_rows_exact - (double)visible_rows;
|
||||
fractional_visible_rows = CLAMP(fractional_visible_rows, 0.0, 1.0);
|
||||
v_scroll->show();
|
||||
v_scroll->set_max(total_rows + _get_visible_lines_offset());
|
||||
v_scroll->set_page(visible_rows + _get_visible_lines_offset());
|
||||
v_scroll->set_max(total_rows);
|
||||
v_scroll->set_page(visible_rows + fractional_visible_rows);
|
||||
set_v_scroll(get_v_scroll());
|
||||
} else {
|
||||
first_visible_line = 0;
|
||||
|
||||
Reference in New Issue
Block a user