remove loaded from our model struct as we dont need it

This commit is contained in:
HikariKnight 2023-04-10 12:29:23 +02:00
parent 4ed469b578
commit 9204f72e91
3 changed files with 3 additions and 6 deletions

View file

@ -13,7 +13,7 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, tea.Quit return m, tea.Quit
case "enter": case "enter":
if m.loaded { if m.width != 0 {
// Process the selected item, if the return value is true then exit the application // Process the selected item, if the return value is true then exit the application
if m.processSelection() { if m.processSelection() {
return m, tea.Quit return m, tea.Quit
@ -33,13 +33,11 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
} }
} }
case tea.WindowSizeMsg: case tea.WindowSizeMsg:
if !m.loaded { if m.width == 0 {
// Initialize the static lists and make sure the content // Initialize the static lists and make sure the content
// does not extend past the screen // does not extend past the screen
m.initLists(msg.Width, msg.Height) m.initLists(msg.Width, msg.Height)
// Set model loaded to true
m.loaded = true
} else { } else {
// Else we are loaded and will update the sizing on the fly // Else we are loaded and will update the sizing on the fly
m.height = msg.Height m.height = msg.Height

View file

@ -10,7 +10,7 @@ import (
) )
func (m model) View() string { func (m model) View() string {
if m.loaded { if m.width != 0 {
title := "" title := ""
switch m.focused { switch m.focused {
case INTRO: case INTRO:

View file

@ -24,7 +24,6 @@ type model struct {
lists []list.Model lists []list.Model
gpu_group string gpu_group string
vbios_path string vbios_path string
loaded bool
focused status focused status
offsetx []int offsetx []int
offsety []int offsety []int