aboutsummaryrefslogtreecommitdiff
path: root/data/core/rootview.lua
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2021-05-15 14:17:36 +0200
committerFrancesco Abbate <francesco.bbt@gmail.com>2021-05-15 14:17:36 +0200
commite2fcc41b4a2ff30a67d8a6aeb59133bdce79ebe1 (patch)
tree29b898ffba71fb36202375f6564c2bd7e437c0b1 /data/core/rootview.lua
parente58d7600eedf9e4015ed94bcbd37818cee801a6e (diff)
downloadlite-xl-e2fcc41b4a2ff30a67d8a6aeb59133bdce79ebe1.tar.gz
lite-xl-e2fcc41b4a2ff30a67d8a6aeb59133bdce79ebe1.zip
Ensure tabs don't extend beyond window's width
Diffstat (limited to 'data/core/rootview.lua')
-rw-r--r--data/core/rootview.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/data/core/rootview.lua b/data/core/rootview.lua
index 5664c08f..4cf50b55 100644
--- a/data/core/rootview.lua
+++ b/data/core/rootview.lua
@@ -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