Hi.

Solaris (and maybe other SunOS distributions) have odd select() syscall 
behavior on tty,
and it affects input-waiting of vim.

[example]

------
while 1
  let c = getchar(0)
  if c != 0
    break
  endif
  sleep 20m
  if another_condition()
    break
  endif
endwhile
------

This script waits user input or establishment of another condition, otherwise 
does sleeping.
Actially it checks input by select() syscall in 2 places; in getchar(0) and end 
of sleep.

* in getchar(0), select() is called with tty non-canonical mode (TMODE_RAW)
* in sleep, select() is called with tty canonical mode (TMODE_SLEEP)

That is;

------
select() [non-canon] ... (a)
(20ms)               ... (b)
select() [canon]     ... (c)
(back to top-of-loop)
select() [non-canon] ... (a')
...
------

On linux and mac (maybe *bsd):

input during (a): detected by select(a) and breaks a loop instantly
input during (b)~(c): not detected by select(c), and detected by select(a') and 
breaks a loop

That is, input during canon-mode is detected at non-canon-mode.

On solaris:

input during (a): detected by select(a) and breaks a loop instantly
input during (b)~(c): not detected by either select(c) or select(a') (unless 
input <CR>)

That is, input during canon-mode is *NOT* detected at non-canon-mode,
so breaking-loop needs input during (a) or input <CR> to finish line-buffering 
(or, in this case, establish another_condition).

# input during (b)~(c) is retained, not diacarded.
# example:
# (b)~(c) <- input "123"
# (a') <- input "4"
# select(a') detects input and read() reads "1234" from tty.

[patch]

Drop ICANON flag (and set VMIN to 1 VTIME to 0) at TMODE_SLEEP

https://gist.github.com/ichizok/acae1b5431a639108dd8cf2768823dc2

# This patch is part of 
https://groups.google.com/forum/#!msg/vim_dev/8ciQGDB-0Og/NiaJYwQHKF8J


Thank you.
- Ozaki Kiichi

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui