Wednesday, March 4, 2015

Re: Bug? (was vimscripting problem w/tabs and expanding width w/numbering option)

Hi L.!

On Mi, 04 Mär 2015, L. A. Walsh wrote:

> Ben Fritz wrote:
> >On Sunday, February 8, 2015 at 5:59:28 PM UTC-6, L. A. Walsh wrote:
> >> It sorta looks like both tabs are being brought up at the same time and a race condition might be happening, but the fact that it
> >>is very deterministic, leads me to believe something else is going on.
> >----
> >It can't be a race condition. Vim is single-threaded and will be processing one whole function at a time.
> ----
> Actually, it is a type of race condition, in that only the 1st
> tab initialized/read in, gets the benefit of the function expanding
> the columns. I'm not sure how to have the function called for
> each tab as it is initialized (no ".vimtabrc" ;-)?)...
>
> I tried using 'tab-specific' vars: i.e.:
>
> func! SetNumberAndWidth()
> set number
> if (! exists("t:added_numwth")) | let t:added_numwth=0 | endif
> if (t:added_numwth < &numberwidth)
> let t:added_numwth = &numberwidth
> let &columns = 2 + t:added_numwth + &columns
> endif
> endf
> if !exists("t:autocommands_loaded")
> let t:autocommands_loaded =1
> au BufReadPost * let ln = line("'\"") | if
> search("vim=:SetNumberAndWidth",'n') | call SetNumberAndWidth() |
> endif
> endif
>
>
> But same problem. As the code above only is called when gvim
> starts -- not for each tab.

I haven't followed closely. Can you please provide a clear example that
exhibits the wrong behaviour when starting from gvim -u myfile -N
and also explain what you expect and what you see instead?

Best,
Christian
--
Die Inseln des Mittelmeeres sind alle größer oder kleiner als Sizilien.
-- Johann Georg August Galletti

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: