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:
J. Adly
2026-06-19 02:03:01 +03:00
committed by github-actions[bot]
parent 0b134d8b23
commit dffacf5c9d

View File

@@ -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()