Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offscreen display spits unwanted text with syntax_hl and relativenumber turned on when another window exist #369

Open
XavierChB opened this issue Oct 1, 2024 · 0 comments
Labels

Comments

@XavierChB
Copy link

Explain the issue

When g:matchparen_offscreen, g:syntax_hl, and vim's relativenumber are turned on, the plugin behaves as expected if there is only one window in the session. However, when there are multiple windows in the session, instead of showing a popup, the plugin would replace the entire matched line (e.g. if my cursor is at line one, the entire line is replaced) with the matched text (including the (relative) line number of the matched line). Note that for the bug to be reliably reproduced, before creating new windows, the cursor needs to move off of any parentheses such that no popup exists at the time the new windows are created.

Minimal working example

Please provide a minimal working example, e.g.,
Any long file with a pair of braces far enough apart such that one of the matching pair goes offscreen when the cursor is on another.

Minimal vimrc file

The following should often suffice:

-- minimal_setup.lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
    vim.fn.system({
        "git",
        "clone",
        "--filter=blob:none",
        "https://github.com/folke/lazy.nvim.git",
        "--branch=stable", -- latest stable release
        lazypath,
    })
end
vim.opt.rtp:prepend(lazypath)


require('lazy').setup({
    {
        'andymass/vim-matchup',
        branch = "master",
        config = function()
            vim.g.matchup_matchparen_deferred = 200
            vim.g.matchup_matchparen_offscreen = {
                method = "popup",
                syntax_hl = 1,
            }
        end
    },
})

vim.opt.relativenumber = true

Note that in this example, matchup_matchparen_deferred is turned on to ensure issue reproduction. In my day-to-day setup, even when the option is turned off, the problem still exists with larger files.

Video of the bug being reproduced

vim-matchup-bug-upload.mp4

Note that the additional window does not need to be the same file; in my common use case, it is usually a file tree like netrw or nvim-tree.

System

vim-matchup: master branch commit 1975afe

nvim: NVIM v0.10.1
Build type: RelWithDebInfo
LuaJIT 2.1.1725453128

@XavierChB XavierChB added the bug label Oct 1, 2024
@XavierChB XavierChB changed the title Offscreen display spits unwanted text with syntax_hl, and relativenumber turned on when another window exist Offscreen display spits unwanted text with syntax_hl and relativenumber turned on when another window exist Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant