[patch] Unclosable fold

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[patch] Unclosable fold

Lech Lorens
It is possible to create an unclosable fold.

By executing the following commands in a new instance of vim:
set fdc=5 fdm=marker fmr={{{,}}} fml=1
normal isome text
normal yy10gp
normal osmall fold {{{
normal ggOlarge fold {{{
5
normal oanother large fold {{{1

You create 2 top-level folds and one small subfold of the second
top-level one. Note that the order in which the folds are created is
essential to reproduce the problem. The second of the top-level folds
cannot be closed with any command.

The reason of this wrong behaviour is the use of an uninitialised
variable - in foldSplit() the field fd_small of the newly created fold
is not initialised to any value, while in fact it should be initialised
to MAYBE.

The attached patch fixes the problem.

--
Cheers,
Lech

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


unclosable-fold.patch (488 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [patch] Unclosable fold

Bram Moolenaar


Lech Lorens wrote:

> It is possible to create an unclosable fold.
>
> By executing the following commands in a new instance of vim:
> set fdc=5 fdm=marker fmr={{{,}}} fml=1
> normal isome text
> normal yy10gp
> normal osmall fold {{{
> normal ggOlarge fold {{{
> 5
> normal oanother large fold {{{1
>
> You create 2 top-level folds and one small subfold of the second
> top-level one. Note that the order in which the folds are created is
> essential to reproduce the problem. The second of the top-level folds
> cannot be closed with any command.
>
> The reason of this wrong behaviour is the use of an uninitialised
> variable - in foldSplit() the field fd_small of the newly created fold
> is not initialised to any value, while in fact it should be initialised
> to MAYBE.
>
> The attached patch fixes the problem.

Great, thanks.

I'm really happy to see so many patches these days!
I should have time tomorrow to verify and include them.

--
LAUNCELOT: Isn't there a St. Aaaaarrrrrrggghhh's in Cornwall?
ARTHUR:    No, that's Saint Ives.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [hidden email] -- 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    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---