Skip to content

Highlighting matching parenthese doesn't work after scrolling viewport #776

Description

@graywolf

Steps to reproduce:

  1. open any file for which vim highlights matching parenthesis
  2. scroll viewport in such a way that only first parenthesis of the pair if visible
  3. move cursor onto the first parenthesis
    • expecting that this will trigger the highlighting
  4. scroll viewport without moving cursor (C-e or mouse wheel) so that the second parenthesis of the pair becomes visible (cursor is still on the first one)
  5. second parenthesis is not highlighted <---- ISSUE

Expected result:

  1. second parenthesis is highlighted

Vim version:

$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 30 2016 14:46:23)
Included patches: 1-1689
Compiled by Arch Linux
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +tag_binary
+arabic          +file_in_path    +mouse_sgr       +tag_old_static
+autocmd         +find_in_path    -mouse_sysmouse  -tag_any_white
+balloon_eval    +float           +mouse_urxvt     +tcl/dyn
+browse          +folding         +mouse_xterm     +terminfo
++builtin_terms  -footer          +multi_byte      +termresponse
+byte_offset     +fork()          +multi_lang      +textobjects
+channel         +gettext         -mzscheme        +timers
+cindent         -hangul_input    +netbeans_intg   +title
+clientserver    +iconv           +packages        +toolbar
+clipboard       +insert_expand   +path_extra      +user_commands
+cmdline_compl   +job             +perl/dyn        +vertsplit
+cmdline_hist    +jumplist        +persistent_undo +virtualedit
+cmdline_info    +keymap          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       +python/dyn      +vreplace
+cscope          +lispindent      +python3/dyn     +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con_gui  +lua/dyn         +rightleft       +writebackup
+diff            +menu            +ruby/dyn        +X11
+digraphs        +mksession       +scrollbind      -xfontset
+dnd             +modify_fname    +signs           +xim
-ebcdic          +mouse           +smartindent     +xsmp_interact
+emacs_tags      +mouseshape      +startuptime     +xterm_clipboard
+eval            +mouse_dec       +statusline      -xterm_save
+ex_extra        +mouse_gpm       -sun_workshop    -xpm
+extra_search    -mouse_jsbterm   +syntax          
   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"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -lncurses -lelf -lnsl    -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/core_perl/CORE -lperl -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc   -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lieee -lm   

Activity

  1. h3xx commented on Apr 22, 2016

    @h3xx

    Confirmed in vim 7.4.1752

  2. Yggdroot commented on Jun 25, 2016

    @Yggdroot

    The matching parentheses is only highlighted between line('w0') and line('w$'), It's not an issue.

  3. h3xx commented on Jun 27, 2016

    @h3xx

    I don't really know why this was closed.

  4. brammool commented on Jun 27, 2016

    @brammool
    Contributor

    The match highlighting is only updated when moving the cursor, not when scrolling. There is no autocommand for scrolling, thus it can't really be changed easily.

  5. graywolf commented on Jun 30, 2016

    @graywolf
    Author

    @brammool How hard would it be to add autocommand for scrolling? Do you believe it can be reasonably done? I've never done any Vim development, but I could try.

  6. brammool commented on Jun 30, 2016

    @brammool
    Contributor

    W wrote:

    @brammool How hard would it be to add autocommand for scrolling? Do
    you believe it can be reasonably done? I've never done any Vim
    development, but I could try.

    This would be when curwin->w_topline changes. Unfortunately this
    currently happens in several places.

    Maybe it works to do it like CursorMoved. That is in main_loop().
    last_cursormoved keeps the previous position.

    Like CursorMoved has CursorMovedI, we may need a separate event for
    scrolling in Insert mode.

    hundred-and-one symptoms of being an internet addict:
    167. You have more than 200 websites bookmarked.

    /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \
    /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \
    \ an exciting new programming language -- http://www.Zimbu.org ///
    \ help me help AIDS victims -- http://ICCF-Holland.org ///

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions