Hello there,

The recent patch for :move with folds calls `foldRemove()` with `MAXLNUM` for the bottom of the range to remove.
This seems like a logical way to say "Remove all folds below here".
For 32 bits, `foldRemove()` can't handle `bot` being `MAXLNUM`, and goes into an endless loop of allocation.

The patch below stops this endless allocation, by allowing `foldRemove()` to take `MAXLNUM` and still work.


diff --git a/src/fold.c b/src/fold.c
index 305173918..3a1d44c2b 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -2928,7 +2928,7 @@ foldRemove(garray_T *gap, linenr_T top, linenr_T bot)
     {
         /* 2: or 3: need to delete nested folds */
         foldRemove(&fp->fd_nested, top - fp->fd_top, bot - fp->fd_top);
-        if (fp->fd_top + fp->fd_len > bot + 1)
+        if (fp->fd_top + fp->fd_len - 1 > bot)
         {
         /* 3: need to split it. */
         foldSplit(gap, (int)(fp - (fold_T *)gap->ga_data), top, bot);

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