andymass / vim-matchup

vim match-up: even better % :facepunch: navigate and highlight matching words :facepunch: modern matchit and matchparen. Supports both vim and neovim + tree-sitter.
https://www.vim.org/scripts/script.php?script_id=5624
MIT License
1.7k stars 71 forks source link

Strange iteraction between offscreen popup and vim-gitgutter plugin #183

Closed Aster89 closed 3 years ago

Aster89 commented 3 years ago

Explain the issue

Given that

The first time (since the file is open) the offscreen popup from vim-matchup is triggered, an error occurs. Following times it doesn't.

I think it is due to the horizontal misalignment between the matching lines that occurs: the non-pum line is pushed right by the gutter, whereas the pum line is not.

Therefore, I suspect that the solution is that the pum line should be added some leading space corresponding to the width of the gutter.

  1. What vim version are you using?
    :ver
    VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 15 2021 21:48:21)
    Included patches: 1-3441
    Compiled by Arch Linux
    Huge version with GTK3 GUI.  Features included (+) or not (-):
    +acl               +cursorshape       +job               +mouse_urxvt       +signs             +user_commands
    +arabic            +dialog_con_gui    +jumplist          +mouse_xterm       +smartindent       +vartabs
    +autocmd           +diff              +keymap            +multi_byte        -sodium            +vertsplit
    +autochdir         +digraphs          +lambda            +multi_lang        +sound             +virtualedit
    -autoservername    +dnd               +langmap           -mzscheme          +spell             +visual
    +balloon_eval      -ebcdic            +libcall           +netbeans_intg     +startuptime       +visualextra
    +balloon_eval_term +emacs_tags        +linebreak         +num64             +statusline        +viminfo
    +browse            +eval              +lispindent        +packages          -sun_workshop      +vreplace
    ++builtin_terms    +ex_extra          +listcmds          +path_extra        +syntax            +wildignore
    +byte_offset       +extra_search      +localmap          +perl/dyn          +tag_binary        +wildmenu
    +channel           -farsi             +lua/dyn           +persistent_undo   -tag_old_static    +windows
    +cindent           +file_in_path      +menu              +popupwin          -tag_any_white     +writebackup
    +clientserver      +find_in_path      +mksession         +postscript        +tcl/dyn           +X11
    +clipboard         +float             +modify_fname      +printer           +termguicolors     -xfontset
    +cmdline_compl     +folding           +mouse             +profile           +terminal          +xim
    +cmdline_hist      -footer            +mouseshape        +python/dyn        +terminfo          -xpm
    +cmdline_info      +fork()            +mouse_dec         +python3/dyn       +termresponse      +xsmp_interact
    +comments          +gettext           +mouse_gpm         +quickfix          +textobjects       +xterm_clipboard
    +conceal           -hangul_input      -mouse_jsbterm     +reltime           +textprop          -xterm_save
    +cryptv            +iconv             +mouse_netterm     +rightleft         +timers
    +cscope            +insert_expand     +mouse_sgr         +ruby/dyn          +title
    +cursorbind        +ipv6              -mouse_sysmouse    +scrollbind        +toolbar
    system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
    2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
    system gvimrc file: "/etc/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
    2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
    fall-back for $VIM: "/usr/share/vim"
    Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include
    /glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include
    /libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/lzo -I/usr/include/pixman-1 -I/usr/
    include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cloudproviders -I/usr/include/atk-1.0 -I/usr/include/at-spi
    2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread -march=x86-64 -mtune=generic
    -O2 -pipe -fno-plt -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
    Linking: gcc -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl
    ,-E -Wl,-rpath,/usr/lib/perl5/5.34/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/local/lib -o vim -
    lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgob
    ject-2.0 -lglib-2.0 -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lelf -lcanberra -lacl -lattr -lgpm -ldl -Wl,-E -Wl,
    -rpath,/usr/lib/perl5/5.34/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/l
    ocal/lib -L/usr/lib/perl5/5.34/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc -L/usr/lib -ltclstub8.6 -ldl -lz -
    lpthread -lm

Minimal working example

Here you see me opening a file and triggering vim-matchup pum before vim-gitgutter has time to draw the gutter, and all is fine. I repeat the attempt when the gutter is in place, and the error occurs. I reapeat again but the error doesn't occur anymore. asciicast

Minimal vimrc file

Copiable from the text-based screencast, at time 00:04

andymass commented 3 years ago

Are you certain the plugin is updated to the latest version?

On Sat, Oct 2, 2021, 1:03 PM Enrico Maria De Angelis < @.***> wrote:

Explain the issue

Given that

  • vim-gitgutter https://github.com/airblade/vim-gitgutter and the file is modified, so that the gutter is in place,
  • vim-matchup is in use, and it uses let g:matchup_matchparen_offscreen = {'method': 'popup', 'highlight': 'OffscreenPopup'}

The first time (since the file is open) the offscreen popup from vim-matchup is triggered, an error occurs. Following times it doesn't.

  1. What vim version are you using?

:ver VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 15 2021 21:48:21) Included patches: 1-3441 Compiled by Arch Linux Huge version with GTK3 GUI. Features included (+) or not (-): +acl +cursorshape +job +mouse_urxvt +signs +user_commands +arabic +dialog_con_gui +jumplist +mouse_xterm +smartindent +vartabs +autocmd +diff +keymap +multi_byte -sodium +vertsplit +autochdir +digraphs +lambda +multi_lang +sound +virtualedit -autoservername +dnd +langmap -mzscheme +spell +visual +balloon_eval -ebcdic +libcall +netbeans_intg +startuptime +visualextra +balloon_eval_term +emacs_tags +linebreak +num64 +statusline +viminfo +browse +eval +lispindent +packages -sun_workshop +vreplace ++builtin_terms +ex_extra +listcmds +path_extra +syntax +wildignore +byte_offset +extra_search +localmap +perl/dyn +tag_binary +wildmenu +channel -farsi +lua/dyn +persistent_undo -tag_old_static +windows +cindent +file_in_path +menu +popupwin -tag_any_white +writebackup +clientserver +find_in_path +mksession +postscript +tcl/dyn +X11 +clipboard +float +modify_fname +printer +termguicolors -xfontset +cmdline_compl +folding +mouse +profile +terminal +xim +cmdline_hist -footer +mouseshape +python/dyn +terminfo -xpm +cmdline_info +fork() +mouse_dec +python3/dyn +termresponse +xsmp_interact +comments +gettext +mouse_gpm +quickfix +textobjects +xterm_clipboard +conceal -hangul_input -mouse_jsbterm +reltime +textprop -xterm_save +cryptv +iconv +mouse_netterm +rightleft +timers +cscope +insert_expand +mouse_sgr +ruby/dyn +title +cursorbind +ipv6 -mouse_sysmouse +scrollbind +toolbar system vimrc file: "/etc/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" system gvimrc file: "/etc/gvimrc" user gvimrc file: "$HOME/.gvimrc" 2nd user gvimrc file: "~/.vim/gvimrc" defaults file: "$VIMRUNTIME/defaults.vim" system menu file: "$VIMRUNTIME/menu.vim" fall-back for $VIM: "/usr/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include /glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include /libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/lzo -I/usr/include/pixman-1 -I/usr/ include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cloudproviders -I/usr/include/atk-1.0 -I/usr/include/at-spi 2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl ,-E -Wl,-rpath,/usr/lib/perl5/5.34/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/local/lib -o vim - lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgob ject-2.0 -lglib-2.0 -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lelf -lcanberra -lacl -lattr -lgpm -ldl -Wl,-E -Wl, -rpath,/usr/lib/perl5/5.34/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/l ocal/lib -L/usr/lib/perl5/5.34/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc -L/usr/lib -ltclstub8.6 -ldl -lz - lpthread -lm

Minimal working example

Here you see me opening a file and triggering vim-matchup pum before vim-gitgutter has time to draw the gutter, and all is fine. I repeat the attempt when the gutter is in place, and the error occurs. I reapeat again but the error doesn't occur anymore. [image: asciicast] https://asciinema.org/a/UrSLE5YyCBIld7tpxtSoYgjcw Minimal vimrc file

Copiable from the text-based screencast, at time 00:04 https://asciinema.org/a/UrSLE5YyCBIld7tpxtSoYgjcw?t=4

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/andymass/vim-matchup/issues/183, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSY3DIYCSOYGWFIZHUCQR3UE43MVANCNFSM5FGSZ7HA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Aster89 commented 3 years ago

Oh, god, I had missed the latest updates. No error, indeed.

However, as regards the alignment, it is like this:

  7 function! LightLineFilename()                                  
    2         \ '' != expand('%:t') ? expand('%:t') : '[No Name]') .
    1         \ ('' != LightLineModified() ? ' ' . LightLineModified() : '')                                                 
  223 endfunction

Not sure if it's intended, but I find it a bit awkward...

andymass commented 3 years ago

If I understand right, the alignment problem is only when the git gutter appears or disappears after a popup is active? That is, if the gutter is present and you move your cursor such that a new popup appears, it appears correct? Or is it persistent?

Aster89 commented 3 years ago

It looks like the misalignment is persistent: asciicast

andymass commented 3 years ago

I think this is fixed now. Thanks for the report.