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
-~----------~----~----~----~------~----~------~--~---
diff --git a/src/fold.c b/src/fold.c
index a127bf6..684f70e 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -2817,6 +2817,8 @@ foldSplit(gap, i, top, bot)
fp[1].fd_top = bot + 1;
fp[1].fd_len = fp->fd_len - (fp[1].fd_top - fp->fd_top);
fp[1].fd_flags = fp->fd_flags;
+ fp[1].fd_small = MAYBE;
+ fp->fd_small = MAYBE;
/* Move nested folds below bot to new fold. There can't be
* any between top and bot, they have been removed by the caller. */