mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	man.vim: no guarantee that the first line contains anything useful
Fixes #5628
This commit is contained in:
		@@ -50,7 +50,7 @@ function! man#open_page(count, count1, mods, ...) abort
 | 
			
		||||
    return
 | 
			
		||||
  endtry
 | 
			
		||||
  call s:push_tag()
 | 
			
		||||
  let bufname = 'man://'.name.(empty(sect)?'':'('.sect.')')
 | 
			
		||||
  let bufname = fnameescape('man://'.name.(empty(sect)?'':'('.sect.')'))
 | 
			
		||||
  if a:mods !~# 'tab' && s:find_man()
 | 
			
		||||
    noautocmd execute 'silent edit' bufname
 | 
			
		||||
  else
 | 
			
		||||
@@ -157,7 +157,7 @@ endfunction
 | 
			
		||||
function! man#pop_tag() abort
 | 
			
		||||
  if !empty(s:tag_stack)
 | 
			
		||||
    let tag = remove(s:tag_stack, -1)
 | 
			
		||||
    silent execute tag['buf'].'buffer'
 | 
			
		||||
    execute 'silent' tag['buf'].'buffer'
 | 
			
		||||
    call cursor(tag['lnum'], tag['col'])
 | 
			
		||||
  endif
 | 
			
		||||
endfunction
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@ let s:pager = 0
 | 
			
		||||
if has('vim_starting')
 | 
			
		||||
  let s:pager = 1
 | 
			
		||||
  " remove all those backspaces
 | 
			
		||||
  silent execute 'keeppatterns keepjumps %substitute,.\b,,e'.(&gdefault?'':'g')
 | 
			
		||||
  execute 'silent keeppatterns keepjumps %substitute,.\b,,e'.(&gdefault?'':'g')
 | 
			
		||||
  if getline(1) =~# '^\s*$'
 | 
			
		||||
    silent keepjumps 1delete _
 | 
			
		||||
  else
 | 
			
		||||
@@ -20,8 +20,12 @@ if has('vim_starting')
 | 
			
		||||
  " This is not perfect. See `man glDrawArraysInstanced`. Since the title is
 | 
			
		||||
  " all caps it is impossible to tell what the original capitilization was.
 | 
			
		||||
  let ref = tolower(matchstr(getline(1), '^\S\+'))
 | 
			
		||||
  let b:man_sect = man#extract_sect_and_name_ref(ref)[0]
 | 
			
		||||
  execute 'silent file man://'.ref
 | 
			
		||||
  try
 | 
			
		||||
    let b:man_sect = man#extract_sect_and_name_ref(ref)[0]
 | 
			
		||||
  catch
 | 
			
		||||
    let b:man_sect = ''
 | 
			
		||||
  endtry
 | 
			
		||||
  execute 'silent file man://'.fnameescape(ref)
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
setlocal buftype=nofile
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user