From 9204f72e9138e421ec62846656963a49022225af Mon Sep 17 00:00:00 2001 From: HikariKnight <2557889+HikariKnight@users.noreply.github.com> Date: Mon, 10 Apr 2023 12:29:23 +0200 Subject: [PATCH] remove loaded from our model struct as we dont need it --- internal/ui_main_events.go | 6 ++---- internal/ui_main_view.go | 2 +- internal/ui_model.go | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/internal/ui_main_events.go b/internal/ui_main_events.go index d308a57..22f9262 100644 --- a/internal/ui_main_events.go +++ b/internal/ui_main_events.go @@ -13,7 +13,7 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, tea.Quit case "enter": - if m.loaded { + if m.width != 0 { // Process the selected item, if the return value is true then exit the application if m.processSelection() { return m, tea.Quit @@ -33,13 +33,11 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } } case tea.WindowSizeMsg: - if !m.loaded { + if m.width == 0 { // Initialize the static lists and make sure the content // does not extend past the screen m.initLists(msg.Width, msg.Height) - // Set model loaded to true - m.loaded = true } else { // Else we are loaded and will update the sizing on the fly m.height = msg.Height diff --git a/internal/ui_main_view.go b/internal/ui_main_view.go index f9a6e0c..247262d 100644 --- a/internal/ui_main_view.go +++ b/internal/ui_main_view.go @@ -10,7 +10,7 @@ import ( ) func (m model) View() string { - if m.loaded { + if m.width != 0 { title := "" switch m.focused { case INTRO: diff --git a/internal/ui_model.go b/internal/ui_model.go index bbe3549..31bf881 100644 --- a/internal/ui_model.go +++ b/internal/ui_model.go @@ -24,7 +24,6 @@ type model struct { lists []list.Model gpu_group string vbios_path string - loaded bool focused status offsetx []int offsety []int