summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeterN <peter@fuzzle.org>2019-03-23 17:59:19 +0000
committerGitHub <noreply@github.com>2019-03-23 17:59:19 +0000
commit4feea8db67ca6d50d6bb02718ba38f0081df4649 (patch)
tree5b5a4a0bf7aa4d171349f07be488a369a4b9c860
parentd7553759661e5c32937ae37b19f0aae1652cb2d7 (diff)
downloadopenttd-4feea8db67ca6d50d6bb02718ba38f0081df4649.tar.xz
Fix: Filtered file list did not scroll properly. (#7402)
-rw-r--r--src/fios_gui.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp
index fd9e0c06a..a4eb12e3a 100644
--- a/src/fios_gui.cpp
+++ b/src/fios_gui.cpp
@@ -437,12 +437,15 @@ public:
GfxFillRect(r.left + 1, r.top + 1, r.right, r.bottom, PC_BLACK);
uint y = r.top + WD_FRAMERECT_TOP;
- for (uint pos = this->vscroll->GetPosition(); pos < this->fios_items.Length(); pos++) {
- if (!this->fios_items_shown[pos]) {
+ uint scroll_pos = this->vscroll->GetPosition();
+ for (uint row = 0; row < this->fios_items.Length(); row++) {
+ if (!this->fios_items_shown[row]) {
/* The current item is filtered out : we do not show it */
+ scroll_pos++;
continue;
}
- const FiosItem *item = this->fios_items.Get(pos);
+ if (row < scroll_pos) continue;
+ const FiosItem *item = this->fios_items.Get(row);
if (item == this->selected) {
GfxFillRect(r.left + 1, y, r.right, y + this->resize.step_height, PC_DARK_BLUE);