Skip to content

bug(image): certain LaTeX math environments cause lines to be hidden on conceallevel >= 2 #2569

@NickHu

Description

@NickHu

Did you check docs and existing issues?

  • I have read all the snacks.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • I have searched the existing issues of snacks.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.11.5

Operating system/version

MacOS 15.7.1 (24G231)

Describe the bug

When loading the following file test.tex:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{gather*}
	a
	\\
	b
	c
	d
	f
	g
	h
	i
	j
	k
\end{gather*}
\end{document}

Lines 9 - 17 (c to k) are always concealed incorrectly when the conceal is supposedly disabled when the cursor is within the environment.

  • If the cursor is not in the gather* environment, it is correctly concealed and the preview image renders
  • If the cursor is on lines 4 - 8, lines 9 - 17 are not shown at all
  • If the cursor is on lines 9 - 17, lines 4 - 8 + only the cursor line are shown
Image

This seems to happen with any of the math environments.

Steps To Reproduce

  1. nvim -u repro.lua test.tex
  2. :TSInstall latex
  3. (maybe restart neovim)
  4. Go to any lines in the environment to observe bad behaviour

Expected Behavior

The whole gather* environment is de-concealed whenever the cursor is inside of it.

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    { "folke/snacks.nvim",               opts = { image = {} } },
    -- add any other plugins here
    { "nvim-treesitter/nvim-treesitter", opts = { ensure_installed = { "latex" } } },
  },
})

vim.opt.conceallevel = 2
vim.opt.number = true

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions