rzyns / macvim

Automatically exported from code.google.com/p/macvim
0 stars 0 forks source link

Bug with the `redraw` function in the GUI version of MacVim #480

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This is a bug I discovered while using a plugin. I described the bug 
extensively in the vim_mac Google Group: 
https://groups.google.com/forum/#!topic/vim_mac/z-IBAFHbQak

For practicality reasons, I will paste the relevant parts of the thread here, 
but if you need more information please feel free to email me or to mention me 
in Twitter (@aziz_light).

(Start of the thread paste)

The bug seems to be with the `redraw` function in files that don't fit in one 
screen. To reproduce, open a "long" file (as in, one with enough lines so that 
it doesn't fit on one screen) with the following command:

mvim -N -u NONE -U NONE file

Then source the vim-bling plugin (because this plugin will force the bug to 
appear):

    :so vim-bling/plugin/bling.vim

The plugin can be found here: https://github.com/ivyl/vim-bling

Alternatively, put the following code in a file (say blink.vim), and source it:

    highlight WhiteOnRed guibg=red
    function! HLNext (blinktime)
      let [bufnum, lnum, col, off] = getpos('.')
      let matchlen = strlen(matchstr(strpart(getline('.'),col-1),@/))
      let target_pat = '\c\%#'.@/
      let ring = matchadd('WhiteOnRed', target_pat, 101)
      redraw
      exec 'sleep ' . float2nr(a:blinktime * 1000) . 'm'
      call matchdelete(ring)
      redraw
    endfunction
    nnoremap <silent> n   n:call HLNext(0.4)<cr>
    nnoremap <silent> N   N:call HLNext(0.4)<cr>

This code also forces the error to appear.

Then search for a word (or even a character) and press `n` or `N`.

Normally, you will see the caret jump at the end of the line before going back 
to the next search result.

Note that I installed MacVim with Homebrew on OS X 10.8.5, but I built the code 
from master/HEAD with the following command:

brew install macvim --HEAD

Here is the output of `mvim --version`:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Oct 17 2013 14:49:06)
  MacOS X (unix) version
  Included patches: 1-52
  Compiled by Homebrew
  Huge version with MacVim GUI.  Features included (+) or not (-):
    +acl             +file_in_path    +mouse_sgr       +tag_binary
     +arabic          +find_in_path    -mouse_sysmouse  +tag_old_static
     +autocmd         +float           +mouse_urxvt     -tag_any_white
     +balloon_eval    +folding         +mouse_xterm     +tcl
     +browse          -footer          +multi_byte      +terminfo
     ++builtin_terms  +fork()          +multi_lang      +termresponse
     +byte_offset     +fullscreen      -mzscheme        +textobjects
     +cindent         -gettext         +netbeans_intg   +title
     +clientserver    -hangul_input    +odbeditor       +toolbar
     +clipboard       +iconv           +path_extra      +transparency
     +cmdline_compl   +insert_expand   +perl            +user_commands
     +cmdline_hist    +jumplist        +persistent_undo +vertsplit
     +cmdline_info    +keymap          +postscript      +virtualedit
     +comments        +langmap         +printer         +visual
     +conceal         +libcall         +profile         +visualextra
     +cryptv          +linebreak       +python          +viminfo
     +cscope          +lispindent      -python3         +vreplace
     +cursorbind      +listcmds        +quickfix        +wildignore
     +cursorshape     +localmap        +reltime         +wildmenu
     +dialog_con_gui  -lua             +rightleft       +windows
     +diff            +menu            +ruby            +writebackup
     +digraphs        +mksession       +scrollbind      -X11
     +dnd             +modify_fname    +signs           -xfontset
     -ebcdic          +mouse           +smartindent     +xim
     +emacs_tags      +mouseshape      -sniff           -xsmp
     +eval            +mouse_dec       +startuptime     -xterm_clipboard
     +ex_extra        -mouse_gpm       +statusline      -xterm_save
     +extra_search    -mouse_jsbterm   -sun_workshop    -xpm
     +farsi           +mouse_netterm   +syntax
     system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
     2nd user vimrc file: "~/.vim/vimrc"
     user exrc file: "$HOME/.exrc"
     system gvimrc file: "$VIM/gvimrc"
     user gvimrc file: "$HOME/.gvimrc"
     2nd user gvimrc file: "~/.vim/gvimrc"
     system menu file: "$VIMRUNTIME/menu.vim"
     fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
     Compilation: cc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X_UNIX -no-cpp-precomp  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1     -I/System/Library/Frameworks/Tcl.framework/Headers  -D_REENTRANT=1  -D_THREAD_SAFE=1  -D_DARWIN_C_SOURCE=1  
     Linking: cc   -L.   -L.    -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lncurses -liconv -framework Cocoa   -fstack-protector -L/usr/local/lib  -L/System/Library/Perl/5.12/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -framework Python  -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation -framework Ruby  

Also, the bug does NOT appear in terminal Vim (even the one that comes with 
MacVim).

(End of the thread paste)

Original issue reported on code.google.com by aziiz.li...@gmail.com on 19 Oct 2013 at 1:26