mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 09:44:31 +00:00 
			
		
		
		
	fix(man): check if buffer is valid before restoring 'tagfunc' (#30180)
This commit is contained in:
		@@ -723,7 +723,7 @@ function M.open_page(count, smods, args)
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  sect, name = extract_sect_and_name_path(path)
 | 
					  sect, name = extract_sect_and_name_path(path)
 | 
				
			||||||
  local buf = fn.bufnr()
 | 
					  local buf = api.nvim_get_current_buf()
 | 
				
			||||||
  local save_tfu = vim.bo[buf].tagfunc
 | 
					  local save_tfu = vim.bo[buf].tagfunc
 | 
				
			||||||
  vim.bo[buf].tagfunc = "v:lua.require'man'.goto_tag"
 | 
					  vim.bo[buf].tagfunc = "v:lua.require'man'.goto_tag"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -739,7 +739,9 @@ function M.open_page(count, smods, args)
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
  end)
 | 
					  end)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  vim.bo[buf].tagfunc = save_tfu
 | 
					  if api.nvim_buf_is_valid(buf) then
 | 
				
			||||||
 | 
					    vim.bo[buf].tagfunc = save_tfu
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if not ok then
 | 
					  if not ok then
 | 
				
			||||||
    error(ret)
 | 
					    error(ret)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user