Hayaki Saito wrote:

> Hi, lists
> 
> I'm recognizing that some people reported "echo-backing problem"(see below) 
> at start-up time on some UNIX terminals.
> 
> https://cloud.githubusercontent.com/assets/1162739/6369447/d0fba520-bd29-11e4-9e9f-49b850953db3.png
> related issue: https://github.com/saitoha/mouseterm-plus/issues/3
> 
> This is easily reproduced by the following command on XTerm:
> 
>     $ vim -u NONE --noplugin -c "set nocompatible | autocmd VimEnter * call 
> system('sleep 3')"
> 
> or
> 
>     $ vim -u NONE --noplugin -c "set nocompatible | autocmd Termresponse * 
> call system('sleep 3')"
> 
> I discussed about it with Yukihiro Nakadaira, then propose the following 
> solution for this problem:
> 
>     - VIM should use new terminal mode "cbreak"(fig.2) during calling 
> system() function on UNIX terminals.
>     - The vim function system() should always be done in non-echo mode 
> without prepending ":silent", at least on UNIX terminals.
>     - To keep the program simply, drop "sleep" mode and replace it with 
> "cbreak" mode.
> 
> 
> Now VIM uses 3 terminal modes "raw"(TMODE_RAW), "cooked"(TMODE_COOK), and 
> "sleep"(TMODE_SLEEP) on UNIX terminals(fig.1).
> 
> As same as almost other TUI applications, VIM works with "raw" terminal mode 
> basically.
> But in the following cases, VIM switches the terminal to "cooked" mode 
> exceptionally.
> 
>     case 1. when entering shell with ":shell" command
>     case 2. during running other processes by such as system() function
>             (required for stopping the child process with <C-c>)
> 
> I think it is appropriate to use "cooked" mode in case 1.
> But in case 2, "cooked" mode sometimes causes "echo-backing problem" with 
> coming into contact with "termresponse" feature.
> 
> Another mode "sleep"(TMODE_SLEEP) is used in ":sleep" command and the 
> internal function mch_delay().
> 
> Attached patch drops "sleep" mode and introduce new terminal mode 
> "cbreak"(fig.2).
> I found "sleep" mode in current VIM can be replaced with "cbreak" mode.
> Additionaly this patch uses "cbreak" mode instead of "cooked" mode in 
> system() function.
> 
> I tested it in OSX10.10 and Linux(Debian sid/CentOS 6.5).
> 
> Note:
> With this patch, the default behavior of system() is slightly changed.
> It comes to be same as the behavior of one always prefixed with ":silent".
> But I believe it is no needs to run system() with non-silent(echo on) mode.
> Remind that stdin/stdout of the process launched by system() is always 
> redirected.
> 
> 
>                       fig.1 existing Vim terminal modes
> 
>         | get input immediately? | signal with ^C | input echo-backing
> --------+------------------------+----------------+--------------------
> raw     | yes                    | no             | no
> --------+------------------------+----------------+--------------------
> cooked  | no                     | yes            | yes
> --------+------------------------+----------------+--------------------
> sleep   | no                     | yes            | no
> --------+------------------------+----------------+--------------------
> 
>                       fig.2 new terminal mode "cbreak"
> 
>         | get input immediately? | signal with ^C | input echo-backing
> --------+------------------------+----------------+-------------------
> cbreak  | yes                    | yes            | no
> --------+------------------------+----------------+-------------------

Thanks for looking into this.  I wonder if there is any situation where
this change would cause problems.  Can a few people, especially those
with plugins that use system(), try this out?


-- 
ARTHUR: I've said I'm sorry about the old woman, but from the behind you
        looked ...
DENNIS: What I object to is that you automatically treat me like an inferior...
ARTHUR: Well ... I AM king.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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