fix(Menu): unselect if there are no menu items
This commit is contained in:
parent
bd87f29cf2
commit
b3388eed77
1 changed files with 4 additions and 1 deletions
|
@ -167,7 +167,10 @@ pub fn State(ctx_type: type) type {
|
|||
self.selected = 0;
|
||||
return;
|
||||
};
|
||||
self.selected = @min(current + 1, self.count() - self.header_count - 1);
|
||||
self.selected = if (self.count() < self.header_count + 1)
|
||||
null
|
||||
else
|
||||
@min(current + 1, self.count() - self.header_count - 1);
|
||||
}
|
||||
|
||||
pub fn select_up(self: *Self) void {
|
||||
|
|
Loading…
Add table
Reference in a new issue