On 10/11/07, Bram Moolenaar <[EMAIL PROTECTED]> wrote:
>
>
> Yakov Lerner wrote:
>
> > :help :! says:
> >                     :silent !{cmd}
> >     The screen is not redrawn then, thus you have to use
> >     CTRL-L or ":redraw!" if the command did display something.
> >
> > The last part ("if the command did display something") is not true.
> > In console vim, screen is always grabled after ':silent !CMD"
> > even if CMD did not print anything. (try ':silent !true' after ':help
> > help').
> > The correct wording would be:
> >
> >                     :silent !{cmd}
> >     The screen is not redrawn then, thus you have to use
> >     CTRL-L or ":redraw!" even if the command did not display anything.
>
> The docs are correct, ":silent !true" doesn't mess up the display for
> me.
>
> Check your shell init scripts for something that produces output.


To make sure that shell init script are not even invoked, I set
      :set shell=/bin/true
Still, screen is cleared after :silent !/bin/true.
In gdb, I caught the place and the string that clears the screen.
The string is "\033[?1049h\033[?1h\033=" (length=15).
It is printed after fork+execve("/bin/true"), at this place:

mch_write ( s=0x820b040 "\033[?1049h\033[?1h\033="..., len=15) at
os_unix.c:307
307         write(1, (char *)s, len);
(gdb) n

[Yakov] the vim screen is cleared at after the write() above

308         if (p_wd)           /* Unix is too fast, slow down a bit more */
(gdb) where
#0  mch_write (
    s=0x820b040 "\033[?1049h\033[?1h\033="..., len=15) at os_unix.c:308
#1  0x081a2b74 in ui_write (
    s=0x820b040 "\033[?1049h\033[?1h\033="..., len=15) at ui.c:51
#2  0x0819ed96 in out_flush () at term.c:2545
#3  0x0819fa6a in starttermcap () at term.c:3233
#4  0x08090393 in do_shell (cmd=0x82155d8 "/bin/true", flags=0) at
ex_cmds.c:1471
#5  0x0808fac8 in do_bang (addr_count=0, eap=0xbf96b110, forceit=0, do_in=1,
do_out=1) at ex_cmds.c:1021
#6  0x080a99de in ex_bang (eap=0xbf96b110) at ex_docmd.c:8305
#7  0x080a0e58 in do_one_cmd (cmdlinep=0xbf96b278, sourcing=0,
cstack=0xbf96b2d4, fgetline=0x80b4454 <getexline>,
    cookie=0x0) at ex_docmd.c:2622
#8  0x0809e718 in do_cmdline (cmdline=0x0, getline=0x80b4454 <getexline>,
cookie=0x0, flags=0) at ex_docmd.c:1100
#9  0x0811b3f5 in nv_colon (cap=0xbf96b658) at normal.c:5168
#10 0x08114a32 in normal_cmd (oap=0xbf96b6f8, toplevel=1) at normal.c:1141
#11 0x080dc833 in main_loop (cmdwin=0, noexmode=0) at main.c:1180
#12 0x080dc383 in main (argc=3, argv=0xbf96b8f4) at main.c:939

After that, there is only one mch_write(), "\033[1;25H" (len=7),
and screen remains empty, and vim waits for input.

Yakov

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui