Blob Blame History Raw
To: vim-dev@vim.org
Subject: Patch 7.0.154
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.0.154
Problem:    When 'foldnextmax' is negative Vim can hang. (James Vega)
Solution:   Avoid the fold level becoming negative.
Files:	    src/fold.c, src/syntax.c


*** ../vim-7.0.153/src/fold.c	Sun Apr 23 00:31:04 2006
--- src/fold.c	Sun Oct 29 20:23:21 2006
***************
*** 2971,2977 ****
--- 2971,2981 ----
      else
  	flp->lvl = get_indent_buf(buf, lnum) / buf->b_p_sw;
      if (flp->lvl > flp->wp->w_p_fdn)
+     {
  	flp->lvl = flp->wp->w_p_fdn;
+ 	if (flp->lvl < 0)
+ 	    flp->lvl = 0;
+     }
  }
  
  /* foldlevelDiff() {{{2 */
*** ../vim-7.0.153/src/syntax.c	Tue Oct  3 17:04:21 2006
--- src/syntax.c	Sun Oct 29 20:21:27 2006
***************
*** 6072,6078 ****
--- 6072,6082 ----
  		++level;
      }
      if (level > wp->w_p_fdn)
+     {
  	level = wp->w_p_fdn;
+ 	if (level < 0)
+ 	    level = 0;
+     }
      return level;
  }
  #endif
*** ../vim-7.0.153/src/version.c	Mon Oct 30 22:31:30 2006
--- src/version.c	Wed Nov  1 12:41:14 2006
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     154,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
134. You consider bandwidth to be more important than carats.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- 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    ///