Bill McCarthy wrote:
On Sun 5-Nov-06 3:21am -0600, Yakov Lerner wrote:

On 11/5/06, Bill McCarthy <[EMAIL PROTECTED]> wrote:

I am having a problem trying to echo a message triggered by
an autocmd on BufEnter when entering a tab page.

Try this:

    :au BufEnter foo echom "Entered foo"

First lets try opening a window on the same tab page:

    :sp foo

The message appears in the command line area as expected.
Switching between windows, the messages is seen each time
foo is entered.

Wipe foo with:  :bw foo

Now try a tab page:

    :tabe foo

The message appears as expected.  However leaving and then
entering the foo tab page does not display the message!

Typing :mes shows that the message was indeed displayed.
What is overwriting it?

I can see this, too. The message is visible for some time if I add
sleep or while getchar(1)|endwh to the rhs of 'au', but disappears
right after that. Is it tab switching that causes wipeout of the
message ?

It shouldn't be, the tab triggers occur before the BufEnter.

I modified the autocmd to do a redraw before the echo.  That
didn't make any difference in this case.  As far as I can
see, there is nothing happening after the echo - yet
something is clearly clearing the line.

Running with default settings, ruler is off but showcmd is
on.  Shutting off showcmd also made no difference.

Looking to confirm the order of event triggers, I found the
following at ":h tabline-menu"

    When switching to another tab page the order is:

            BufLeave
            WinLeave
            TabLeave
            TabEnter
            WinEnter
            BufEnter

I decided to test this by writing the following script:

============================================================
                  Contents of tabtest.vim
============================================================
au BufLeave * se ch=1 au WinLeave * se ch=1
au TabLeave * se ch=1
au TabEnter * se ch=1
au WinEnter * se ch=1
au BufEnter * se ch=1
au BufEnter foo redraw|echo "Entered foo"
tabe foo
tabn
se vbs=99 vfile=/pad/temp/vfile
tabn
qa
============================================================

I ran the above with this:

    gvim -u NONE -i NONE -N "+so tabtest.vim"

and received this:

============================================================
                Contents of /pad/temp/vfile
============================================================

           line 11: tabn
           Executing BufLeave Auto commands for "*"
autocommand se ch=1 line 0: se ch=1 Executing WinLeave Auto commands for "*"
           autocommand se ch=1

           line 0: se ch=1
           Executing TabLeave Auto commands for "*"
           autocommand se ch=1

           line 0: se ch=1
           Executing WinEnter Auto commands for "*"
           autocommand se ch=1

           line 0: se ch=1
           Executing TabEnter Auto commands for "*"
           autocommand se ch=1

           line 0: se ch=1
           Executing BufEnter Auto commands for "*"
           autocommand se ch=1

           line 0: se ch=1
           Executing BufEnter Auto commands for "foo"
           autocommand redraw|echo "Entered foo"

           line 0: redraw|echo "Entered foo"
line 0: echo "Entered foo"
Entered foo
           line 12: qa
============================================================

Although "Entered foo" is clearly sent to the command line,
it is being wiped out by something - still unknown.

Note that the order of triggering specified in the docs (and
quoted above) appears to be wrong.  As you can see above,
TabEnter is triggered after WinEnter (not before it).


Somehow I see neither

        foo 123L, 2458C

nor

        foo [New File]

in your verbosefile; I thought one of them should be issued?

Does it make any difference if you set 'cmdheight' to 2 instead?


Best regards,
Tony.

Reply via email to