To: [email protected]
Subject: Patch 6.0aw.001
Fcc: outbox
From: Bram Moolenaar <[email protected]>
------------

Patch 6.0aw.001
Problem:    When using histget() with an index that's below all existing
           entries, Vim would hang. (Yegappan Lakshmanan)
Solution:   Break out of the loop when all history items have been checked.
Files:      src/ex_getln.c


*** ../vim-6.0aw/src/ex_getln.c Sun Sep 16 22:21:05 2001
--- src/ex_getln.c      Mon Sep 17 10:57:06 2001
***************
*** 3722,3727 ****
--- 3722,3728 ----
 {
     int               i;
     histentry_T       *hist;
+     int               wrapped = FALSE;

     if (hislen == 0 || histype < 0 || histype >= HIST_COUNT
                   || (i = hisidx[histype]) < 0 || num == 0)
***************
*** 3732,3740 ****
     {
       while (hist[i].hisnum > num)
           if (--i < 0)
               i += hislen;
!       if (hist[i].hisnum == num
!               && hist[i].hisstr != NULL)
           return i;
     }
     else if (-num <= hislen)
--- 3733,3745 ----
     {
       while (hist[i].hisnum > num)
           if (--i < 0)
+           {
+               if (wrapped)
+                   break;
               i += hislen;
!               wrapped = TRUE;
!           }
!       if (hist[i].hisnum == num && hist[i].hisstr != NULL)
           return i;
     }
     else if (-num <= hislen)

--
hundred-and-one symptoms of being an internet addict:
225. You sign up for free subscriptions for all the computer magazines

///  Bram Moolenaar -- [email protected] -- http://www.moolenaar.net  \\\
(((   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   )))
\\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///