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
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

View file

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

View file

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