Tuesday, February 18, 2014

Re: Typeahead character loss when running Vim.

On 19/02/14 01:36, Kaz Kylheku wrote:
> Hello?
>
> I asked this nearly two years ago; doesn't anyone else have this problem?
>
> Is it fixed in newer versions of Vim?
>
> On an Ubuntu 11.04 which has a dated version of Vim, if I do this:
>
> $ vim some_file
>
> and upon hitting enter, immediately type, "io", sometimes Vim ends up in
> command mode as if nothing was typed, then sometimes it ends up in an
> insert on the same line, and the character o has been entered, as expected.
> Most of the time, though, one of the other four possibilities happens,
> based on which of the two characters is dropped, or both: it's in command
> mode, insert mode on the same line, or insert mdoe with a new line having
> been o)pened.

If you type something "immediately" after invoking Vim from the sh
command-line, then there is a race condition between the human typing at
the keyboard and the system loading and starting Vim. I would expect
that the io input would or would not be received, or even might be
received only partly, by Vim, depending on who wins the race.

A possible reason for this race condition to exist (rather than Vim
using the system's keyboard-typeahead buffer as found as startup) is
that when running in an xterm, Vim tries to determine the xterm version
by querying the xterm (sending a control command to the "display") and
waiting for a corresponding response stream of control characters on its
"keyboard" input line. If this is the case you should not experience any
loss in the non-X Linux consoles (accessed by Ctrl-Alt-F1 to
Ctrl-Alt-F6; come back to X by Ctrl-Alt-F7 or Ctrl-Alt-F8 depending on
"I don't know what").

IMHO the "healthy" way to proceed would be for the human to wait on Vim
displaying either the ":intro" splash screen or the contents of the
first editfile before proceeding to type anything at the keyboard. This
way (i.e. with a wait loop inserted into the human's firmware) it can be
guaranteed that there is no race condition, and that Vim is always in a
known state when the first keyboard byte is sent to the console or X
interface.


Best regards,
Tony.
--
I think I'll KILL myself by leaping out of this 14th STORY WINDOW while
reading ERICA JONG'S poetry!!

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: