On Mi, 28 Jun 2017, Bram Moolenaar wrote:

> 
> Christian Brabandt wrote:
> 
> > I am maintaining a eye-candy statusline plugin, that can also create a 
> > nice tabline. I recently made a change, trying to improve the 
> > performance of the plugin by caching certain values 
> > (https://github.com/vim-airline/vim-airline/commit/b2f301f73c168104cf2202ac5f2e2b7c078c7aa1)
> > 
> > The issue can be reproduced with this little vim snippet:
> > ,----
> > | function! TabTitle(n)
> > |  let title = gettabvar(a:n, 'title')
> > |  if empty(title)
> > |     " call an expensive function to get the title
> > |     " try to avoid the expensive call, by caching the title
> > |     let title='foobar'
> > |  endif
> > |  "if a:n == tabpagenr()
> > |  "   let t:title = title
> > |  "endif
> > |  call settabvar(a:n, 'title', title)
> > |  return title
> > | endfunction
> > | 
> > | function! DrawTabline()
> > |  let tabline = ''
> > |  for i in range(1, tabpagenr('$'))
> > |      let tabline .= "%(Tab: ".i.' "%{TabTitle('.i.')}"%)'
> > |  endfor
> > |  return tabline
> > | endfunction
> > | set tabline=%!DrawTabline()
> > `----
> 
> Hmm, switching tabs halfway updating the display is something that
> should be avoided.

That is not what I intended to do (and it is not obvious from the 
documentation, that settabvar() would switch tabpages, so it sounded 
safe.

> > On a second thought, it might be better not to set must_redraw for 
> > settabvar() at all, since after we are finished, we switch back the 
> > tabpage, and thus theoretically a redraw should not be necessary. So 
> > perhaps this patch is preferable:
> 
> Yeah, not setting must_redraw there has unpredictable effects.

Not sure I understand. That means, it should be changed, yes?

> Nice catch.  Happens when typing CTL-L in any window but the first one.

Thanks for including.

Best,
Christian
-- 
Ich glaube, ein Mann will von einer Frau das gleiche wie eine Frau von
einem Mann: Respekt.
                -- Clint Eastwood

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