Skip to content

Commit

Permalink
fix(man): avoid setting v:errmsg (neovim#30052)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeertzjq authored Aug 15, 2024
1 parent 4199671 commit ee5aaba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion runtime/lua/man.lua
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,13 @@ local function put_page(page)
-- XXX: nroff justifies text by filling it with whitespace. That interacts
-- badly with our use of $MANWIDTH=999. Hack around this by using a fixed
-- size for those whitespace regions.
vim.cmd([[silent! keeppatterns keepjumps %s/\s\{199,}/\=repeat(' ', 10)/g]])
-- Use try/catch to avoid setting v:errmsg.
vim.cmd([[
try
keeppatterns keepjumps %s/\s\{199,}/\=repeat(' ', 10)/g
catch
endtry
]])
vim.cmd('1') -- Move cursor to first line
highlight_man_page()
set_options()
Expand Down
2 changes: 1 addition & 1 deletion test/functional/plugin/man_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ local function get_search_history(name)
local args = vim.split(name, ' ')
local code = [[
local args = ...
local man = require('runtime.lua.man')
local man = require('man')
local res = {}
man.find_path = function(sect, name)
table.insert(res, {sect, name})
Expand Down

0 comments on commit ee5aaba

Please sign in to comment.