The attached patch fixes 3 problems with folding in Vim:
1. Cursor position not being updated after deleting a marker fold
(details were provided in <20081217234549.ga23...@localdomain> on
18-Dec-2008).

2. Folds being incorrectly refreshed after deleting a marker fold.
The problem was reported by Dominique Pelle in
<[email protected]>.

3. Wrong folds being deleted when performing a fold-delete on a range of
lines. To reproduce the problem, edit a file with the following contents:
a
b
c
d
e
f
g
h

Perform the following actions:
:setlocal foldmethod=manual
:setlocal foldcolumn=4
:silent! normal! zE
:1,2fold
:3,4fold
:3,6fold
:7,8fold
:1,8fold
:normal 3G
:set foldlevel=1
:foldopen
:foldopen
Now in normal mode do
Vkzd
and observe how the (1,2) and (1,8) folds are deleted instead of (1,2)
and (3,4).

-- 
Cheers,
Lech

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

*** src/.svn/text-base/fold.c.svn-base	2008-12-01 00:34:32.000000000 +0100
--- src/fold.c	2008-12-25 22:02:46.000000000 +0100
***************
*** 748,759 ****
--- 748,761 ----
      int		did_one = FALSE;
      linenr_T	first_lnum = MAXLNUM;
      linenr_T	last_lnum = 0;
+     colnr_T	len;
  
      checkupdate(curwin);
  
      while (lnum <= end)
      {
  	/* Find the deepest fold for "start". */
+ 	use_level = FALSE;
  	gap = &curwin->w_folds;
  	found_ga = NULL;
  	lnum_off = 0;
***************
*** 783,789 ****
  	else
  	{
  	    lnum = found_fp->fd_top + found_fp->fd_len + found_off;
- 	    did_one = TRUE;
  
  	    if (foldmethodIsManual(curwin))
  		deleteFoldEntry(found_ga,
--- 785,790 ----
***************
*** 791,805 ****
  	    else
  	    {
  		if (found_fp->fd_top + found_off < first_lnum)
! 		    first_lnum = found_fp->fd_top;
  		if (lnum > last_lnum)
  		    last_lnum = lnum;
! 		parseMarker(curwin);
  		deleteFoldMarkers(found_fp, recursive, found_off);
  	    }
  
  	    /* redraw window */
  	    changed_window_setting();
  	}
      }
      if (!did_one)
--- 792,808 ----
  	    else
  	    {
  		if (found_fp->fd_top + found_off < first_lnum)
! 		    first_lnum = found_off + found_fp->fd_top;
  		if (lnum > last_lnum)
  		    last_lnum = lnum;
! 		if(!did_one)
! 		    parseMarker(curwin);
  		deleteFoldMarkers(found_fp, recursive, found_off);
  	    }
  
  	    /* redraw window */
  	    changed_window_setting();
+ 	    did_one = TRUE;
  	}
      }
      if (!did_one)
***************
*** 811,816 ****
--- 814,825 ----
  	    redraw_curbuf_later(INVERTED);
  #endif
      }
+     else
+     {
+ 	len = (colnr_T)STRLEN(ml_get_curline());
+ 	if(curwin->w_cursor.col >= len)
+ 	    curwin->w_cursor.col = (colnr_T)(len? len - 1: 0);
+     }
      if (last_lnum > 0)
  	changed_lines(first_lnum, (colnr_T)0, last_lnum, 0L);
  }

Raspunde prin e-mail lui