refactor(#2826): singleton View class, WIP

This commit is contained in:
Alexander Courtis
2025-04-20 13:54:37 +10:00
parent a3fe0c9007
commit 9d3d0d220f
15 changed files with 84 additions and 80 deletions

View File

@@ -41,7 +41,7 @@ function M.fn(opts)
return
end
if view.is_visible() then
if view.View:is_visible() then
-- focus
if opts.focus then
lib.set_target_win()

View File

@@ -23,7 +23,7 @@ function M.fn(opts)
opts.path = nil
end
if view.is_visible() then
if view.View:is_visible() then
-- focus
lib.set_target_win()
view.focus()

View File

@@ -8,7 +8,7 @@ function M.fn(opts)
if opts == nil then
-- reset to config values
view.View:configure_width()
view.resize()
view.View:resize()
return
end
@@ -17,7 +17,7 @@ function M.fn(opts)
if width_cfg ~= nil then
view.View:configure_width(width_cfg)
view.resize()
view.View:resize()
return
end
@@ -28,7 +28,7 @@ function M.fn(opts)
local absolute = options.absolute
if type(absolute) == "number" then
view.resize(absolute)
view.View:resize(absolute)
return
end
@@ -39,7 +39,7 @@ function M.fn(opts)
relative_size = "+" .. relative_size
end
view.resize(relative_size)
view.View:resize(relative_size)
return
end
end

View File

@@ -40,7 +40,7 @@ function M.fn(opts, no_focus, cwd, bang)
opts.path = nil
end
if view.is_visible() then
if view.View:is_visible() then
-- close
view.View:close()
else