fix: if there's only one focusable item, don't unfocus
This commit is contained in:
parent
42fd5c76bb
commit
ed9ad80e18
1 changed files with 3 additions and 0 deletions
|
|
@ -142,6 +142,7 @@ where
|
|||
|
||||
match self.count.focused {
|
||||
None if self.current == self.count.total - 1 => state.focus(),
|
||||
Some(0) if self.current == 0 && self.count.total == 1 => {}
|
||||
Some(0) if self.current == 0 => state.unfocus(),
|
||||
Some(0) if self.current == self.count.total - 1 => {
|
||||
state.focus()
|
||||
|
|
@ -184,6 +185,8 @@ where
|
|||
) {
|
||||
match self.count.focused {
|
||||
None if self.current == 0 => state.focus(),
|
||||
Some(focused)
|
||||
if focused == self.current && self.count.total == 1 => {}
|
||||
Some(focused) if focused == self.current => state.unfocus(),
|
||||
Some(focused) if focused + 1 == self.current => state.focus(),
|
||||
Some(focused)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue