mirror of
https://github.com/folke/snacks.nvim
synced 2025-07-13 08:05:08 +00:00
fix(zen): always count cmdheight towards Zen bottom offset (#1402)
## Description Zen window height should always account for `cmdheight` (not only if `statusline` is enabled) and be computed dynamically when `cmdheight > 0` to avoid the `cmdline` obstructing the Zen window. ## Related Issue(s) - Fixes https://github.com/folke/snacks.nvim/issues/1401 - Fixes https://github.com/folke/snacks.nvim/issues/1375 ## Screenshots Before:  After: 
This commit is contained in:
parent
70e7e081ee
commit
041bf1da9e
1 changed files with 2 additions and 2 deletions
|
@ -84,7 +84,7 @@ Snacks.util.set_hl({
|
||||||
---@param opts? {statusline: boolean, tabline: boolean}
|
---@param opts? {statusline: boolean, tabline: boolean}
|
||||||
local function get_main(opts)
|
local function get_main(opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
local bottom = opts.statusline and (vim.o.cmdheight + (vim.o.laststatus == 3 and 1 or 0)) or 0
|
local bottom = vim.o.cmdheight + (opts.statusline and vim.o.laststatus == 3 and 1 or 0)
|
||||||
local top = opts.tabline
|
local top = opts.tabline
|
||||||
and ((vim.o.showtabline == 2 or (vim.o.showtabline == 1 and #vim.api.nvim_list_tabpages() > 1)) and 1 or 0)
|
and ((vim.o.showtabline == 2 or (vim.o.showtabline == 1 and #vim.api.nvim_list_tabpages() > 1)) and 1 or 0)
|
||||||
or 0
|
or 0
|
||||||
|
@ -127,7 +127,7 @@ function M.zen(opts)
|
||||||
local show_indicator = false
|
local show_indicator = false
|
||||||
|
|
||||||
-- calculate window size
|
-- calculate window size
|
||||||
if win_opts.height == 0 and (opts.show.statusline or opts.show.tabline) then
|
if win_opts.height == 0 and (opts.show.statusline or opts.show.tabline or vim.o.cmdheight > 0) then
|
||||||
local main = get_main(opts.show)
|
local main = get_main(opts.show)
|
||||||
win_opts.row = main.row
|
win_opts.row = main.row
|
||||||
win_opts.height = function()
|
win_opts.height = function()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue