Fix "Mark Range": reduce maximum namespaces in `favorites`, fix shadowing of ctrl+space (#2927)
* fix: avoid creating a ctrl+space key when index out of range * fix: reduce maximum favorite namespaces to 9, making space for "all" * fix: correct index incrementation * refactor: remove usage of NumKeys * feat: check for favorite namespace index in NumKeys * feat: break when out of number keys, increment index when slot foundmine
parent
59918d0e89
commit
99d47ab7e7
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
const (
|
||||
// MaxFavoritesNS number # favorite namespaces to keep in the configuration.
|
||||
MaxFavoritesNS = 10
|
||||
MaxFavoritesNS = 9
|
||||
)
|
||||
|
||||
// Namespace tracks active and favorites namespaces.
|
||||
|
|
|
|||
|
|
@ -585,13 +585,19 @@ func (b *Browser) namespaceActions(aa *ui.KeyActions) {
|
|||
aa.Add(ui.Key0, ui.NewKeyAction(client.NamespaceAll, b.switchNamespaceCmd, true))
|
||||
b.namespaces[0] = client.NamespaceAll
|
||||
index := 1
|
||||
for _, ns := range b.app.Config.FavNamespaces() {
|
||||
favNamespaces := b.app.Config.FavNamespaces()
|
||||
for _, ns := range favNamespaces {
|
||||
if ns == client.NamespaceAll {
|
||||
continue
|
||||
}
|
||||
aa.Add(ui.NumKeys[index], ui.NewKeyAction(ns, b.switchNamespaceCmd, true))
|
||||
b.namespaces[index] = ns
|
||||
index++
|
||||
if numKey, ok := ui.NumKeys[index]; ok {
|
||||
aa.Add(numKey, ui.NewKeyAction(ns, b.switchNamespaceCmd, true))
|
||||
b.namespaces[index] = ns
|
||||
index++
|
||||
} else {
|
||||
log.Warn().Msgf("No number key available for favorite namespace %s (%d of %d). Skipping...", ns, index, len(favNamespaces))
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue