mirror of
https://github.com/neovim/neovim.git
synced 2026-08-01 05:09:08 +00:00
fix(man.lua): highlight codeblocks #40310
Problem:
:Man does not syntax highlight codeblocks (injected language).
Analysis:
init_pager() swapped pcall(parse_ref, ref) return values order, so
vim.b.man_sect was set to the manpage name instead of the section
number, so C syntax highlighting did not load.
Solution:
Swap the calls.
(cherry picked from commit 67b3cceaa7)
This commit is contained in:
committed by
github-actions[bot]
parent
0b134d8b23
commit
dffacf5c9d
@@ -669,8 +669,8 @@ function M.init_pager()
|
||||
-- know the correct casing, cf. `man glDrawArraysInstanced`).
|
||||
--- @type string
|
||||
local ref = (fn.getline(1):match('^[^)]+%)') or ''):gsub(' ', '_')
|
||||
local _, sect, err = pcall(parse_ref, ref)
|
||||
vim.b.man_sect = err ~= nil and sect or ''
|
||||
local ok, _, sect = pcall(parse_ref, ref)
|
||||
vim.b.man_sect = ok and (sect or '') or ''
|
||||
|
||||
local man_bufname = 'man://' .. fn.fnameescape(ref):lower()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user