mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 17:21:49 +00:00
Don't set manwidth wider than the window (#34078)
fix: set manwidth to not exceed the window width If we set the MANWIDTH variable to a value wider than the window, the contents wrap and formatting breaks. A more sensible way to handle this is to interpret MANWIDTH as a maximum width, but to set the width to the window size if smaller. See also: #9023, #10748.
This commit is contained in:

committed by
GitHub

parent
dfad613813
commit
2045e9700c
@@ -415,11 +415,12 @@ local function get_page(path, silent)
|
||||
-- Disable hard-wrap by using a big $MANWIDTH (max 1000 on some systems #9065).
|
||||
-- Soft-wrap: ftplugin/man.lua sets wrap/breakindent/….
|
||||
-- Hard-wrap: driven by `man`.
|
||||
local manwidth --- @type integer|string
|
||||
local manwidth --- @type integer
|
||||
if (vim.g.man_hardwrap or 1) ~= 1 then
|
||||
manwidth = 999
|
||||
elseif vim.env.MANWIDTH then
|
||||
manwidth = vim.env.MANWIDTH --- @type string|integer
|
||||
vim.env.MANWIDTH = tonumber(vim.env.MANWIDTH) or 0
|
||||
manwidth = math.min(vim.env.MANWIDTH, api.nvim_win_get_width(0) - vim.o.wrapmargin)
|
||||
else
|
||||
manwidth = api.nvim_win_get_width(0) - vim.o.wrapmargin
|
||||
end
|
||||
|
Reference in New Issue
Block a user