Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add floating views #1518

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix removing the last View of a node without a parent
  • Loading branch information
Guldoman committed May 22, 2023
commit 1895edbb23bb412a81381f224ff47bf787d4b96a
21 changes: 12 additions & 9 deletions data/core/node.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function Node:new(type)
self.tab_offset = 1
self.tab_width = style.tab_width
self.move_towards = View.move_towards
self.hovered_scroll_button = 0
end


Expand Down Expand Up @@ -125,20 +126,22 @@ function Node:remove_view(root, view)
end
else
local parent = self:get_parent_node(root)
local is_a = (parent.a == self)
local other = parent[is_a and "b" or "a"]
local locked_size_x, locked_size_y = other:get_locked_size()
local locked_size
if parent.type == "hsplit" then
locked_size = locked_size_x
else
locked_size = locked_size_y
local locked_size, other, is_a
if parent then
is_a = (parent.a == self)
other = parent[is_a and "b" or "a"]
local locked_size_x, locked_size_y = other:get_locked_size()
if parent.type == "hsplit" then
locked_size = locked_size_x
else
locked_size = locked_size_y
end
end
local next_primary
if self.is_primary_node then
next_primary = core.root_view:select_next_primary_node()
end
if locked_size or (self.is_primary_node and not next_primary) then
if not parent or locked_size or (self.is_primary_node and not next_primary) then
self.views = {}
self:add_view(EmptyView())
else
Expand Down