selecta: Keyboard input issues after integrating with Vim 7.4.430?
Using Selecta with Vim is buggy for me after upgrading to Vim 7.4.430, though I don’t have enough information to rule out a coincidence.
Behavior
- Keyboard input is now extremely sluggish. The display often takes near a second to sync.
- All control-keys with the exception of
^Chave stopped working, i.e. they do nothing. - Pressing the backspace key also does nothing.
Setup
I am integrating Selecta with Vim as suggested in the README:
function! SelectaCommand(choice_command, selecta_args, vim_command)
try
silent let selection = system(a:choice_command . " | selecta " . a:selecta_args)
catch /Vim:Interrupt/
" Swallow the ^C so that the redraw below happens; otherwise there will be
" leftovers from selecta on the screen
redraw!
return
endtry
redraw!
exec a:vim_command . " " . selection
endfunction
nnoremap <leader>p :call SelectaCommand("find * -type f", "", ":e")<cr>
Selecta
I am running 8179c87.
Vim
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Sep 2 2014 09:11:05)
MacOS X (unix) version
Included patches: 1-430
Compiled by Homebrew
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +syntax
+arabic +file_in_path +mouse_sgr +tag_binary
+autocmd +find_in_path -mouse_sysmouse +tag_old_static
-balloon_eval +float +mouse_urxvt -tag_any_white
-browse +folding +mouse_xterm -tcl
++builtin_terms -footer +multi_byte +terminfo
+byte_offset +fork() +multi_lang +termresponse
+cindent -gettext -mzscheme +textobjects
-clientserver -hangul_input +netbeans_intg +title
+clipboard +iconv +path_extra -toolbar
+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 -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
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -F/usr/local/Frameworks -DMACOS_X_UNIX -Os -w -pipe -march=native -mmacosx-version-min=10.9 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang -L. -L/Users/user/.rbenv/versions/2.1.2/lib -fstack-protector -L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -o vim -lm -lncurses -liconv -framework Cocoa -fstack-protector -L/usr/local/lib -L/System/Library/Perl/5.16/darwin-thread-multi-2level/CORE -lperl -framework Python -lruby-static -framework CoreFoundation -lgmp -lobjc -L/Users/user/.rbenv/versions/2.1.2/lib
I am running OS X 10.9.4.
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 25 (13 by maintainers)
Commits related to this issue
- Remove `silent` from `selecta` invocation Prevents a regression on vim 7.4.430 and later where backspace stops working, and keys are dropped. Due to a change in how Vim spawns a subprocess. https:/... — committed to fabioyamate/vimfiles by fabioyamate 10 years ago
- silent causing issues for OS X users apparently See garybernhardt/selecta#56 — committed to jhawthorn/fzy by jhawthorn 10 years ago
- Don't use silent in selecta commands See garybernhardt/selecta#56 — committed to vheon/dotvim by vheon 10 years ago
- Vim bizarre regression that prevents backspace to work on selecta garybernhardt/selecta#56 — committed to mavcunha/vim by mavcunha 9 years ago
- Remove `silent` to allow backspace in selecta See https://github.com/garybernhardt/selecta/issues/56#issuecomment-55210457 — committed to reidef/dotfiles-old by deleted user 8 years ago
I figured it out. Vim shells out to run an external command by calling
mch_call_shell, which actually busywaits for the child process to finish. This is done inwait4pid(note the use ofWNOHANG), which callsmch_delay, and that function screws with the terminal mode. Specifically, if the terminal is in raw mode (which, as of patch #427, is the case whensilentis used), it will be set toTMODE_SLEEP, which is cooked mode without echo. So when Selecta is running withsilent, vim is performing the following sequence in a continuous loop:Another weird consequence of this (which can be seen by attaching
straceor running vim from ascript(1)session and then firing up Selecta) is that vim will emit a continuous stream of exotic xterm control sequences to the terminal to repeatedly enable and disable mouse support.