Vim's 400 line function to wait for keyboard input
geoff.greer.fm
Vim's 400 line function to wait for keyboard input
1–10 of 239 posts
Re: Vim's 400 line function to wait for keyboard input
#2Re: Vim's 400 line function to wait for keyboard input
#3Re: Vim's 400 line function to wait for keyboard input
#4To my knowledge, maintaining compatibility is one of the stated goals of Vim, even at the expense of performance. NeoVim is supposed to strip out some of these antiquated features.
Decomposing this function into different implementations with appropriate abstraction doesn't need to break compatibility.
Re: Vim's 400 line function to wait for keyboard input
#5The question is do you think it could have been done better given that they support multiple OS/UI, etc...
Re: Vim's 400 line function to wait for keyboard input
#6Re: Vim's 400 line function to wait for keyboard input
#7 if (msec > 0 && (
# ifdef FEAT_XCLIPBOARD
xterm_Shell != (Widget)0
# if defined(USE_XSMP) || defined(FEAT_MZSCHEME)
||
# endif
# endif
# ifdef USE_XSMP
xsmp_icefd != -1
# ifdef FEAT_MZSCHEME
||
# endif
# endif
# ifdef FEAT_MZSCHEME
(mzthreads_allowed() && p_mzq > 0)
# endif
))
When they could have written: if (msec > 0 && (
# ifdef FEAT_XCLIPBOARD
xterm_Shell != (Widget)0 ||
# endif
# ifdef USE_XSMP
xsmp_icefd != -1 ||
# endif
# ifdef FEAT_MZSCHEME
(mzthreads_allowed() && p_mzq > 0) ||
# endif
0))
Perhaps they were targeting compilers so primitive that they could not optimize out a "|| 0".(edited to hide my shame)
Re: Vim's 400 line function to wait for keyboard input
#8Re: Vim's 400 line function to wait for keyboard input
#9I suppose there may be some negative performance impact if we need to use it for an automated/batch workflow (I can't think of many where something like 'sed' won't be better suited).
Re: Vim's 400 line function to wait for keyboard input
#10To my knowledge, maintaining compatibility is one of the stated goals of Vim, even at the expense of performance. NeoVim is supposed to strip out some of these antiquated features.