Allow tabs to always be visible
This commit is contained in:
parent
609795701d
commit
c7d044f178
|
@ -12,6 +12,7 @@ config.non_word_chars = " \t\n/\\()\"':,.;<>~!@#$%^&*|+=[]{}`?-"
|
||||||
config.undo_merge_timeout = 0.3
|
config.undo_merge_timeout = 0.3
|
||||||
config.max_undos = 10000
|
config.max_undos = 10000
|
||||||
config.max_tabs = 10
|
config.max_tabs = 10
|
||||||
|
config.always_show_tabs = false
|
||||||
config.highlight_current_line = true
|
config.highlight_current_line = true
|
||||||
config.line_height = 1.2
|
config.line_height = 1.2
|
||||||
config.indent_size = 2
|
config.indent_size = 2
|
||||||
|
|
|
@ -262,7 +262,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
function Node:get_tab_overlapping_point(px, py)
|
function Node:get_tab_overlapping_point(px, py)
|
||||||
if #self.views == 1 then return nil end
|
if not self:should_show_tabs() then return nil end
|
||||||
local tabs_number = self:get_visible_tabs_number()
|
local tabs_number = self:get_visible_tabs_number()
|
||||||
local x1, y1, w, h = self:get_tab_rect(self.tab_offset)
|
local x1, y1, w, h = self:get_tab_rect(self.tab_offset)
|
||||||
local x2, y2 = self:get_tab_rect(self.tab_offset + tabs_number)
|
local x2, y2 = self:get_tab_rect(self.tab_offset + tabs_number)
|
||||||
|
@ -272,6 +272,16 @@ function Node:get_tab_overlapping_point(px, py)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function Node:should_show_tabs()
|
||||||
|
if self.locked then return false end
|
||||||
|
if #self.views > 1 then return true
|
||||||
|
elseif config.always_show_tabs then
|
||||||
|
return not self.views[1]:is(EmptyView)
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local function close_button_location(x, w)
|
local function close_button_location(x, w)
|
||||||
local cw = style.icon_font:get_width("C")
|
local cw = style.icon_font:get_width("C")
|
||||||
local pad = style.padding.y
|
local pad = style.padding.y
|
||||||
|
@ -415,7 +425,7 @@ end
|
||||||
function Node:update_layout()
|
function Node:update_layout()
|
||||||
if self.type == "leaf" then
|
if self.type == "leaf" then
|
||||||
local av = self.active_view
|
local av = self.active_view
|
||||||
if #self.views > 1 then
|
if self:should_show_tabs() then
|
||||||
local _, _, _, th = self:get_tab_rect(1)
|
local _, _, _, th = self:get_tab_rect(1)
|
||||||
av.position.x, av.position.y = self.position.x, self.position.y + th
|
av.position.x, av.position.y = self.position.x, self.position.y + th
|
||||||
av.size.x, av.size.y = self.size.x, self.size.y - th
|
av.size.x, av.size.y = self.size.x, self.size.y - th
|
||||||
|
@ -570,7 +580,7 @@ end
|
||||||
|
|
||||||
function Node:draw()
|
function Node:draw()
|
||||||
if self.type == "leaf" then
|
if self.type == "leaf" then
|
||||||
if #self.views > 1 then
|
if self:should_show_tabs() then
|
||||||
self:draw_tabs()
|
self:draw_tabs()
|
||||||
end
|
end
|
||||||
local pos, size = self.active_view.position, self.active_view.size
|
local pos, size = self.active_view.position, self.active_view.size
|
||||||
|
|
Loading…
Reference in New Issue