Ensure tabs don't extend beyond window's width

This commit is contained in:
Francesco Abbate 2021-05-15 14:17:36 +02:00
parent e58d7600ee
commit e2fcc41b4a
1 changed files with 2 additions and 1 deletions

View File

@ -278,7 +278,8 @@ end
function Node:get_tab_rect(idx)
local tw = math.min(style.tab_width, math.ceil(self.size.x / #self.views))
local twp = math.floor((self.size.x - style.padding.x) / #self.views + 0.5)
local tw = math.min(style.tab_width, twp)
local h = style.font:get_height() + style.padding.y * 2
return self.position.x + (idx-1) * tw, self.position.y, tw, h
end