fix: scrollbar range fix and new tests for the same

fix: now the scrollbar also should work within the range it is provided

adjusted the tests according to the new scrollbar functinality

attempted to fix testcases for scrollbar
This commit is contained in:
X1Vi
2025-12-01 15:53:21 +05:30
parent 7ed0b61676
commit 442c117fb7
2 changed files with 47 additions and 44 deletions

View File

@@ -6587,7 +6587,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 {
@@ -8616,9 +8616,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;