Hi Ben! On Di, 15 Feb 2011, Ben Schmidt wrote:
> On 15/02/11 3:34 AM, Christian Brabandt wrote: >> On Mon, February 14, 2011 12:34 pm, Ben Schmidt wrote: >>> I think there is a bug here, but it's not the bug you think. >>> >>> I can make a short single line fold, but it doesn't always do it at >>> first. It seems I have to make a two-line fold and then shorten it >>> before the single line will fold. I think this is the bug. It should >>> fold straight away. >> >> I don't agree. If I set foldminline to zero, vim perfectly folds even >> a single screen line. But whenever the line length changes and crosses >> the 'foldminline' limit, it does not automatically apply the folds. >> You need to force evaluating the fold logic, for example by using zx or >> setting foldminlines. And I would consider this a bug. > > Sorry; I was unclear. What I meant was not that it 'should fold straight > away' but that it 'should be foldable straight away'. > > I'm baffled by you wanting to set 'foldminlines' to zero. The help says: > > "Sets the minimum number of screen lines for a fold to be displayed > closed." > > So, if it is set to 1 (the default), a single screen line should be able > to be displayed closed. And it seems that if the number of screen lines > in a fold *drops* to one, it is foldable. But if the number of screen > lines in a fold *increases* to one, it isn't. This indeed seems to be > about folds being evaluated, and doing :set fml=0 does indeed make > single-line folds display as closed, and :set fml=1 stops them being > displayed closed. Well, I thought of it as complete screen lines. So there must be at least 1 screen line until the screen end, until foldminlines=1 applies. (It needs at a minimum 1 complete screen line). > > :set fml=2 seems to behave in such a way that the minimum number of > screen lines to fold is 3. > > So yes, it seems there are two bugs: > > (1) folds aren't dynamically re-evaluated correctly/sufficiently in > light of foldminlines. > (2) the help for foldminlines is inaccurate. > > One thing that is at least simple to do is change the help. How about: > > "Sets the minimum number of screen lines that must be saved by closing a > fold for a fold to be displayed closed at all. If set to 0 this means > even single-line folds can be displayed closed, even though this is no > more compact than displaying them open." > > This is about the best I can do without making the name of the option > 'foldminlines' completely meaningless. Sounds good to me. > > Or is the current help correct, and the implementation should be changed > to match it (in which case we have a couple of implementation bugs > here)? Yes setting something like curwin->w_foldinvalid = true, whenever a screen line is longer than 'foldminlines'. Something like this. regards, Christian -- 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
