Benji Fisher wrote:

> On Tue, May 02, 2006 at 02:17:58PM +0200, Bram Moolenaar wrote:
> > 
> > Eric Arnold wrote:
> > 
> > > I haven't been idle on this.  I was unable to get my test case working
> > > for a simple but un-obvious reason.  It requires that at least one
> > > other window be open.
> > > 
> > > Run the following, and open two windows.  Edit a file in one.  Open a
> > > new line, which I assume triggers the tabline to trigger as the buffer
> > > becomes modified.  Then as you move the cursor around, you should see
> > > the "Tst#" prompt incrementing with each keystroke.
> 
> > I don't see the problem.
> 
>      I can reproduce this.  As Eric says, it is a little tricky.  I
> wrote the following to test.vim:
> 
> let s:counter = 0
> function! Tst()
>       call Tst_set_hl()
>       let s:counter += 1
>       echo 'Tst#'.s:counter
>       return 'A test string'
> endfunction
> 
> set tabline=%!Tst()
> 
> if &showtabline < 1
>       set showtabline=1       " 2=always
> endif
> 
> 
> function! Tst_set_hl()
>       hi! Tst_hl term=bold
> endfunction
> 
>      Then I started vim with
> 
> $ vim -u test.vim --noplugin test.vim
> 
> (almost as good as -u NONE, right?)  It seems that the problem comes up
> (sometimes) when there are two tabs and two windows in one of them:
> 
> :tabnew
> gt
> :sp
> 
> Now, starting from Normal mode, I open a new line and type some
> characters:
> 
> oxxxx
> 
> The message shows up, and the number increases by 2 each time I add a
> character.

Well, yes, I can see that.  What I don't understand is why you expect it
not to increase.

What happens is that during the redraw of the tabline ":hi" is used,
which causes a redraw.  So 'tabline' is evaluated again and again.  You
must actually be lucky that Vim doesn't hang.

Just make sure that drawing the tabline doesn't cause Vim to redraw the
display.  In this example you could check if the Tst_hl highlight was
already set.

-- 
Your company is doomed if your primary product is overhead transparencies.
                                (Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

Reply via email to