diff --git a/internal/ui/chat/composer.go b/internal/ui/chat/composer.go index b587b9f..8bd6deb 100644 --- a/internal/ui/chat/composer.go +++ b/internal/ui/chat/composer.go @@ -74,7 +74,7 @@ func newComposer(cfg *config.Config, chat *Model) *composer { cache: cache.New(), mentionsList: mentionslist.NewModel(cfg), } - c.Box = ui.ConfigureBox(c.Box, &cfg.Theme) + ui.ConfigureBox(c.Box, &cfg.Theme) c. SetPlaceholder(tview.NewLine(tview.NewSegment("Select a channel to start chatting", tcell.StyleDefault.Dim(true)))). SetClipboard( diff --git a/internal/ui/chat/guilds_tree.go b/internal/ui/chat/guilds_tree.go index 821147b..7376a4a 100644 --- a/internal/ui/chat/guilds_tree.go +++ b/internal/ui/chat/guilds_tree.go @@ -42,8 +42,7 @@ func newGuildsTree(cfg *config.Config, chat *Model) *guildsTree { guildNodeByID: make(map[discord.GuildID]*tree.Node), channelNodeByID: make(map[discord.ChannelID]*tree.Node), } - - gt.Box = ui.ConfigureBox(gt.Box, &cfg.Theme) + ui.ConfigureBox(gt.Box, &cfg.Theme) gt. SetRoot(tree.NewNode("")). SetTopLevel(1). diff --git a/internal/ui/chat/mentionslist/model.go b/internal/ui/chat/mentionslist/model.go index 9ad3869..cce62e6 100644 --- a/internal/ui/chat/mentionslist/model.go +++ b/internal/ui/chat/mentionslist/model.go @@ -16,7 +16,7 @@ type Model struct { func NewModel(cfg *config.Config) *Model { l := list.NewModel() - l.Box = ui.ConfigureBox(l.Box, &cfg.Theme) + ui.ConfigureBox(l.Box, &cfg.Theme) l. SetSelectedStyle(tcell.StyleDefault.Reverse(true)). SetSnapToItems(true). diff --git a/internal/ui/chat/messages_list.go b/internal/ui/chat/messages_list.go index 08bdf92..666975e 100644 --- a/internal/ui/chat/messages_list.go +++ b/internal/ui/chat/messages_list.go @@ -82,7 +82,7 @@ func newMessagesList(cfg *config.Config, chat *Model) *messagesList { } ml.attachmentsPicker = newAttachmentsPicker(cfg, chat) - ml.Box = ui.ConfigureBox(ml.Box, &cfg.Theme) + ui.ConfigureBox(ml.Box, &cfg.Theme) ml.SetTitle("Messages") ml.SetBuilder(ml.buildItem) ml.SetChangedFunc(ml.onRowCursorChanged) diff --git a/internal/ui/util.go b/internal/ui/util.go index 4e0f3ee..077c460 100644 --- a/internal/ui/util.go +++ b/internal/ui/util.go @@ -15,7 +15,7 @@ import ( ) // ConfigureBox configures the provided box according to the provided theme. -func ConfigureBox(box *tview.Box, cfg *config.Theme) *tview.Box { +func ConfigureBox(box *tview.Box, cfg *config.Theme) { border := cfg.Border normalBorderStyle, activeBorderStyle := border.NormalStyle.Style, border.ActiveStyle.Style normalBorderSet, activeBorderSet := border.NormalSet.BorderSet, border.ActiveSet.BorderSet @@ -52,12 +52,11 @@ func ConfigureBox(box *tview.Box, cfg *config.Theme) *tview.Box { if border.Enabled { box.SetBorders(tview.BordersAll) } - - return box } func ConfigurePicker(model *picker.Model, cfg *config.Config, title string) { - model.Box = ConfigureBox(tview.NewBox(), &cfg.Theme) + model.Box = tview.NewBox() + ConfigureBox(model.Box, &cfg.Theme) // When a child of the parent flex is focused, the parent layout itself is not reported as focused. // Instead, the focused child (picker) is considered focused. // Therefore, we manually set the active border style on the picker to ensure it displays the correct focused appearance.