diff --git a/lua/vgit/ui/Scene.lua b/lua/vgit/ui/Scene.lua index 0cded3b3..b1c02f7f 100644 --- a/lua/vgit/ui/Scene.lua +++ b/lua/vgit/ui/Scene.lua @@ -4,12 +4,10 @@ local Scene = Object:extend() function Scene:constructor() return { + length = 0, components = {}, - state = { - length = 0, - component_order = {}, - default_global_opts = {}, - }, + component_order = {}, + default_global_opts = {}, } end @@ -17,7 +15,7 @@ function Scene:get_components() local ordered_components = {} for key, component in pairs(self.components) do - local order = self.state.component_order[key] + local order = self.component_order[key] ordered_components[order] = component end @@ -25,9 +23,9 @@ function Scene:get_components() end function Scene:set(key, component) - self.state.length = self.state.length + 1 - self.state.component_order[key] = self.state.length + self.length = self.length + 1 self.components[key] = component + self.component_order[key] = self.length return self end