Skip to content

Commit fcac7e2

Browse files
committed
feat: add overlap statusline setting for vertical=bottom
1 parent 367f29d commit fcac7e2

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

doc/incline.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,8 @@ window.margin.vertical~
261261
- If an `int >= 0`, the value is used for both the top and bottom margin.
262262
- If a table, both `top` and `bottom` fields must be present.
263263

264-
If `window.placement.vertical` is `top` and 'laststatus' is `3`, you can set
265-
`window.overlap.borders` to `true` to allow Incline statuslines to overlap
266-
window borders.
264+
If 'laststatus' is `3`, you can set `window.overlap.borders` to `true`
265+
to allow Incline statuslines to overlap window borders.
267266

268267
*incline-config-window.margin.horizontal*
269268
window.margin.horizontal~
@@ -280,11 +279,11 @@ window.margin.horizontal~
280279
window.overlap~
281280
Type: `table`
282281
Valid: `table { tabline: bool, winbar: bool, borders: bool }`
283-
Default: `{ tabline: false, winbar: false, borders: true }`
282+
Default: `{ tabline: false, winbar: false, borders: true, statusline: false }`
284283

285284
Controls which bars and lines the inline windows are allowed to overlap.
286285
- `tabline` takes priority over `winbar` for windows at the top of the tabpage,
287-
if both are set.
286+
if both are set and `vertical == "top"`.
288287
- `borders` takes priority for windows below the top of the tabpage.
289288

290289
*incline-config-window.winhighlight*

lua/incline/config/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ M.schema = Schema(function(s)
3434
winbar = s:entry(false, vx.bool),
3535
tabline = s:entry(false, vx.bool),
3636
borders = s:entry(true, vx.bool),
37+
statusline = s:entry(false, vx.bool),
3738
},
3839
placement = {
3940
vertical = s:entry('top', vx.any { 'top', 'bottom' }),

lua/incline/winline.lua

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,26 @@ function Winline:get_win_geom_row()
9696
return cw.margin.vertical.top
9797
end
9898
elseif placement.vertical == 'bottom' then
99-
return a.nvim_win_get_height(self.target_win) - cw.margin.vertical.bottom
99+
if
100+
vim.o.laststatus ~= 3
101+
or (
102+
(
103+
a.nvim_win_get_position(self.target_win)[1]
104+
+ a.nvim_win_get_height(self.target_win)
105+
+ 1 -- for global status
106+
) == vim.o.lines
107+
)
108+
then
109+
if config.window.overlap.statusline then
110+
return a.nvim_win_get_height(self.target_win) - cw.margin.vertical.bottom
111+
else
112+
return a.nvim_win_get_height(self.target_win) - (cw.margin.vertical.bottom + 1)
113+
end
114+
elseif vim.o.laststatus == 3 and config.window.overlap.borders then
115+
return a.nvim_win_get_height(self.target_win) - cw.margin.vertical.bottom
116+
end
117+
118+
return a.nvim_win_get_height(self.target_win) - (cw.margin.vertical.bottom + 1)
100119
end
101120
assert(false, 'invalid value for placement.vertical: ' .. tostring(placement.vertical))
102121
end

0 commit comments

Comments
 (0)