Browse Source

Fix selection maximum index

tags/v0.6.0
Andrew Belt 6 years ago
parent
commit
9d4bce9c3a
2 changed files with 11 additions and 2 deletions
  1. +10
    -1
      src/app/ModuleBrowser.cpp
  2. +1
    -1
      src/tags.cpp

+ 10
- 1
src/app/ModuleBrowser.cpp View File

@@ -209,8 +209,17 @@ struct BrowserList : List {
int selected = 0;

void step() override {
// Count items
int n = 0;
for (Widget *child : children) {
BrowserListItem *item = dynamic_cast<BrowserListItem*>(child);
if (item) {
n++;
}
}
// If we have zero children, this result doesn't matter anyway.
selected = clamp(selected, 0, children.size() - 1);
selected = clamp(selected, 0, n - 1);
// Find and select item
int i = 0;
for (Widget *child : children) {
BrowserListItem *item = dynamic_cast<BrowserListItem*>(child);


+ 1
- 1
src/tags.cpp View File

@@ -1,4 +1,4 @@
v#include "tags.hpp"
#include "tags.hpp"


namespace rack {


Loading…
Cancel
Save