Skip to content

Commit

Permalink
fix(tui): Skip deprecated (hidden) categories when scrolling through
Browse files Browse the repository at this point in the history
  • Loading branch information
ja-he committed Dec 6, 2023
1 parent 796ced6 commit 7ee85c5
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions internal/control/cli/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -664,19 +664,23 @@ func NewController(
"j": action.NewSimple(func() string { return "switch to next category" }, func() {
for i, cat := range controller.data.Categories {
if cat == controller.data.CurrentCategory {
if i+1 < len(controller.data.Categories) {
controller.data.CurrentCategory = controller.data.Categories[i+1]
return
for ii := i + 1; ii < len(controller.data.Categories); ii++ {
if !controller.data.Categories[ii].Deprecated {
controller.data.CurrentCategory = controller.data.Categories[ii]
return
}
}
}
}
}),
"k": action.NewSimple(func() string { return "switch to previous category" }, func() {
for i, cat := range controller.data.Categories {
if cat == controller.data.CurrentCategory {
if i-1 >= 0 {
controller.data.CurrentCategory = controller.data.Categories[i-1]
return
for ii := i - 1; ii >= 0; ii-- {
if !controller.data.Categories[ii].Deprecated {
controller.data.CurrentCategory = controller.data.Categories[ii]
return
}
}
}
}
Expand Down

0 comments on commit 7ee85c5

Please sign in to comment.