diff --git a/src/textfile_gui.cpp b/src/textfile_gui.cpp --- a/src/textfile_gui.cpp +++ b/src/textfile_gui.cpp @@ -124,11 +124,11 @@ void TextfileWindow::SetupScrollbars(boo if (IsWidgetLowered(WID_TF_WRAPTEXT)) { /* Reflow is mandatory if text wrapping is on */ uint height = this->ReflowContent(); - this->vscroll->SetCount(std::min(UINT16_MAX, height)); + this->vscroll->SetCount(ClampTo(height)); this->hscroll->SetCount(0); } else { uint height = force_reflow ? this->ReflowContent() : this->GetContentHeight(); - this->vscroll->SetCount(std::min(UINT16_MAX, height)); + this->vscroll->SetCount(ClampTo(height)); this->hscroll->SetCount(this->max_length + WidgetDimensions::scaled.frametext.Horizontal()); }