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

Lagging and artifacts displayed on screen when typing key frequently #53

Closed
cool4zbl opened this issue Aug 7, 2017 · 8 comments
Closed

Comments

@cool4zbl
Copy link

cool4zbl commented Aug 7, 2017

I found a strange bug recently when typing hjkl frequently to move the cursor in normal mode,
vim repeated occasional hjkl letters, see the below figure.
vim-waketime-bug

so when moving left with h, some of the cursor through the local characters into h.
But in my observation found that the content did not actually change that character, as if covered with a layer in the above.
I tried exit vim and re-open the file, but in normal mode the same problem occurred again when I move the cursor frequently. Stuck in a long time and did not know why.

So I decided to dig in and do the steps below:

  1. Comment out (or remove) about half your vimrc file.
  2. Restart Vim, or open a new Vim (reloading the vimrc is not good enough, as settings aren't unset).
  3. Is the problem now gone? Put back the part you removed out (keeping Vim open and using undo is useful here) and repeat step 1 on the part you added back.
  4. Does the problem still occur? Go to step 1.

Finally, I found if I comment vim-wakatime plugin, this problem solved!
Seemed it was processing a Python command when the bug occurred.

Environment: Mac OS 10.12.6,

 vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jan 30 2017 04:49:52)
MacOS X (unix) version
Included patches: 1-271
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     -tcl
-balloon_eval    +folding         +mouse_xterm     +termguicolors
-browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     -gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
-clientserver    +insert_expand   +packages        -toolbar
+clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        +perl            +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       +python          +vreplace
+cscope          +lispindent      -python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con      -lua             +rightleft       +writebackup
+diff            +menu            +ruby            -X11
+digraphs        +mksession       +scrollbind      -xfontset
-dnd             +modify_fname    +signs           -xim
-ebcdic          +mouse           +smartindent     -xpm
+emacs_tags      -mouseshape      +startuptime     -xsmp
+eval            +mouse_dec       +statusline      -xterm_clipboard
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax
+farsi           +mouse_netterm   +tag_binary
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -framework Cocoa   -mmacosx-version-min=10.12 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.24.0_1/lib/perl5/5.24.0/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -F/usr/local/opt/python/Frameworks -framework Python   -lruby.2.4.0 -lobjc

Hoping there is a solution.

@alanhamlett
Copy link
Member

alanhamlett commented Aug 7, 2017

Try adding this line to your ~/.vimrc file:

let g:wakatime_ScreenRedraw = 1

Then restart Vim.

@cool4zbl
Copy link
Author

cool4zbl commented Aug 7, 2017

@alanhamlett
I'm sorry, adding let g:wakatime_ScreenRedraw = 1 to my ~/.vimrc do not solve the issue.
It occurs again.
😕

image
wakatime-bug

@alanhamlett
Copy link
Member

For now if this happens you can redraw the screen with this command:

:redraw!

The redraw setting should run that command automatically, so I'll find out why it's not working.

@evturn
Copy link

evturn commented Sep 3, 2017

I have also been experiencing this when using the hjkl keys after vim has been idle for more than a few seconds. I also tried this using Neovim with the same .vimrc and plugins only it doesn't print the characters but instead freezes for the same duration in which the characters would be printed in vim.

@alanhamlett
Copy link
Member

d7b6f18 sets the default redraw setting to enabled if the plugin takes too long forking the wakatime-cli process. After updating vim-wakatime, is this issue fixed?

@evturn
Copy link

evturn commented Sep 5, 2017

@alanhamlett that did the trick. thanks for for the help!

@alanhamlett
Copy link
Member

@cool4zbl does this fix it for you too?

@alanhamlett alanhamlett changed the title Causing Vim exception when typing key freqently in normal mode Lagging and artifacts displayed on screen when typing key frequently Oct 4, 2017
@alanhamlett
Copy link
Member

Fixed in v6.0.0 using Vim 8.0+ async.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants