Bram,
consider this:

cat /tmp/dict
catharsis
catechism
catastrophe

vim -u NONE -N -c 'set cpt=k,. dictionary=/tmp/dict'

$put ='canz'
$put ='canq'
0put ='ca'
Got to the end of the first line, and press <C-N>

Note, how Vim hangs. This happens, because in the function 
ins_compl_get_exp() in edit.c:4406 Vim will start an endless loop, 
because the search wraps and it will keep finding matches and not 
terminate the loop.

Attached patch fixes this.

This behaviour was mentioned at
http://stackoverflow.com/questions/20968671

Best,
Christian
-- 

-- 
-- 
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/groups/opt_out.
diff --git a/src/edit.c b/src/edit.c
--- a/src/edit.c
+++ b/src/edit.c
@@ -4403,10 +4403,22 @@
 		    found_new_match = search_for_exact_line(ins_buf, pos,
 					      compl_direction, compl_pattern);
 		else
+		{
+		    pos_T prev = (pos_T)*pos;
+		    int prev_match = (found_new_match != FAIL);
+
 		    found_new_match = searchit(NULL, ins_buf, pos,
 							      compl_direction,
 				 compl_pattern, 1L, SEARCH_KEEP + SEARCH_NFMSG,
 						  RE_LAST, (linenr_T)0, NULL);
+		    if (prev_match)
+		    {
+			/* We had previously found a match and the match wrapped */
+			if ((compl_direction == FORWARD && ltoreq((pos_T)*pos, prev)) ||
+			    (compl_direction == BACKWARD && ltoreq(prev, (pos_T)*pos)))
+				found_new_match = FAIL;
+		    }
+		}
 		--msg_silent;
 		if (!compl_started)
 		{

Raspunde prin e-mail lui