Vim erroneously re-indents the current line if in virtual replace mode
<C-Y> or <C-E> is pressed while the line above or below respectively is
not long enough.

To reproduce the problem execute:

$ vim -u NONE -U NONE -i NONE -c 'set nocp noet ts=8 inde=0 indk=<:>' \
                              -c 'call feedkeys("2G$gR\<C-Y>\<C-Y>")' \
                              file.txt

where file.txt is:
#v+
abcdefghijklmnopqrstuvwxyz
                 1 2 3 4 5
#v-

The result should be:
#v+
abcdefghijklmnopqrstuvwxyz
                 1 2 3 4 z
#v-

but it is:
#v+
abcdefghijklmnopqrstuvwxyz
1 2 3 4 z        1 2 3 4 5
#v-


The problem is caused by 0 passed to in_cinkeys() as the typed key.
Function in_cinkeys() is then unable to recognise the "not found" return
value from get_special_key_code().

The attached patch fixes the problem.

-- 
Cheers,
Lech

-- 
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
diff --git a/src/edit.c b/src/edit.c
index 19e5b8d..2c5cc48 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -1419,7 +1419,7 @@ normalchar:
 	    inserted_space = FALSE;
 
 #ifdef FEAT_CINDENT
-	if (can_cindent && cindent_on()
+	if (c != NUL && can_cindent && cindent_on()
 # ifdef FEAT_INS_EXPAND
 		&& ctrl_x_mode == 0
 # endif
@@ -7397,6 +7397,11 @@ in_cinkeys(keytyped, when, line_is_empty)
     int		icase;
     int		i;
 
+    if (NUL == keytyped)
+    {
+	EMSG2(_(e_intern2), "in_cinkeys()");
+	return FALSE;
+    }
 #ifdef FEAT_EVAL
     if (*curbuf->b_p_inde != NUL)
 	look = curbuf->b_p_indk;	/* 'indentexpr' set: use 'indentkeys' */

Raspunde prin e-mail lui