From 764a9b3775df8feb00a00b22413923e7e223602f Mon Sep 17 00:00:00 2001 From: ayn2op Date: Fri, 21 Aug 2026 20:04:19 -0400 Subject: [PATCH] refactor(ui,config): flatten embedded literals --- internal/config/keybinds.go | 32 +++++++++++++++----------------- internal/ui/chat/guilds_tree.go | 2 +- internal/ui/util.go | 15 ++++++--------- 3 files changed, 22 insertions(+), 27 deletions(-) diff --git a/internal/config/keybinds.go b/internal/config/keybinds.go index 3d13423..764c2c4 100644 --- a/internal/config/keybinds.go +++ b/internal/config/keybinds.go @@ -158,23 +158,21 @@ func defaultGuildsTreeKeybinds() GuildsTreeKeybinds { func defaultMessagesListKeybinds() MessagesListKeybinds { return MessagesListKeybinds{ SelectionKeybinds: defaultSelectionKeybinds(), - ScrollKeybinds: ScrollKeybinds{ - ScrollUp: desc("scr up"), - ScrollDown: desc("scr down"), - ScrollTop: desc("scr top"), - ScrollBottom: desc("scr btm"), - }, - SelectReply: desc("sel reply"), - Reply: desc("reply"), - ReplyMention: desc("@reply"), - Cancel: desc("cancel"), - Edit: desc("edit"), - Delete: desc("force delete"), - DeleteConfirm: desc("delete"), - Open: desc("open"), - YankContent: desc("copy text"), - YankURL: desc("copy url"), - YankID: desc("copy id"), + ScrollUp: desc("scr up"), + ScrollDown: desc("scr down"), + ScrollTop: desc("scr top"), + ScrollBottom: desc("scr btm"), + SelectReply: desc("sel reply"), + Reply: desc("reply"), + ReplyMention: desc("@reply"), + Cancel: desc("cancel"), + Edit: desc("edit"), + Delete: desc("force delete"), + DeleteConfirm: desc("delete"), + Open: desc("open"), + YankContent: desc("copy text"), + YankURL: desc("copy url"), + YankID: desc("copy id"), } } diff --git a/internal/ui/chat/guilds_tree.go b/internal/ui/chat/guilds_tree.go index e2ef81e..b50d2bd 100644 --- a/internal/ui/chat/guilds_tree.go +++ b/internal/ui/chat/guilds_tree.go @@ -122,7 +122,7 @@ func (gt *guildsTree) unreadStyle(indication ningen.UnreadIndication) tcell.Styl } func (gt *guildsTree) guildNodeStyle(guildID discord.GuildID) tcell.Style { - indication := gt.state.GuildIsUnread(guildID, ningen.GuildUnreadOpts{UnreadOpts: ningen.UnreadOpts{IncludeMutedCategories: true}}) + indication := gt.state.GuildIsUnread(guildID, ningen.GuildUnreadOpts{IncludeMutedCategories: true}) return gt.unreadStyle(indication) } diff --git a/internal/ui/util.go b/internal/ui/util.go index ffa54fd..4ecaf28 100644 --- a/internal/ui/util.go +++ b/internal/ui/util.go @@ -10,7 +10,6 @@ import ( "github.com/ayn2op/ningen/v3" "github.com/ayn2op/tview" "github.com/ayn2op/tview/grid" - "github.com/ayn2op/tview/list" "github.com/ayn2op/tview/picker" ) @@ -55,14 +54,12 @@ func ConfigurePicker(model *picker.Model, cfg *config.Config, title string) { SetThumbStyle(cfg.Theme.ScrollBar.ThumbStyle.Style). SetGlyphSet(cfg.Theme.ScrollBar.GlyphSet.GlyphSet)) model.SetKeybinds(picker.Keybinds{ - Cancel: cfg.Keybinds.Picker.Cancel.Keybind, - Keybinds: list.Keybinds{ - SelectUp: cfg.Keybinds.Picker.SelectUp.Keybind, - SelectDown: cfg.Keybinds.Picker.SelectDown.Keybind, - SelectTop: cfg.Keybinds.Picker.SelectTop.Keybind, - SelectBottom: cfg.Keybinds.Picker.SelectBottom.Keybind, - }, - Select: cfg.Keybinds.Picker.Select.Keybind, + Cancel: cfg.Keybinds.Picker.Cancel.Keybind, + SelectUp: cfg.Keybinds.Picker.SelectUp.Keybind, + SelectDown: cfg.Keybinds.Picker.SelectDown.Keybind, + SelectTop: cfg.Keybinds.Picker.SelectTop.Keybind, + SelectBottom: cfg.Keybinds.Picker.SelectBottom.Keybind, + Select: cfg.Keybinds.Picker.Select.Keybind, }) }