To reproduce, do the following in a newly started vim:

First enable 'h' moving between lines to give us a way to delete over
BOL, though <left> would work if you're using gvim
:set ww=h

then, ix<CR><C-o>dh

that is, insert a line containing "x", then try to delete over BOL
without leaving insert mode from the next line.  "x" can be replaced
with any string, though not an empty line.
Vim comes back with:

E341: Internal error: lalloc(0, )
cannot yank; delete anyway (y/n)?

Which is bad enough, but if you say 'n' at the prompt, press enter
to dismiss the new prompt ("E470: Command aborted Press ENTER or type
command to continue"), then type 2 more characters as though you're
still happily in insert mode, vim will SEGV because it screwed up it's
internal idea of where the cursor is.

This seems to be because both coladvance and nv_left increment the
cursor column, resulting in an off-by-one error that eventually leads
to yank_copy_line believing that no characters were affected and
trying to allocate 0 space for the 0 characters (thus the E341).  So,
the fix seems to be that nv_left should only increment the cursor
column if coladvance (or, more accurately, getvpos) has not already
moved it.

The following patch fixes it, but Bram or someone else more familiar
with the codebase might well be able to suggest a better way.

~Matt


Index: src/normal.c
===================================================================
--- src/normal.c        (revision 625)
+++ src/normal.c        (working copy)
@@ -5854,7 +5854,9 @@
                            || cap->oap->op_type == OP_CHANGE)
                        && !lineempty(curwin->w_cursor.lnum))
                {
-                   ++curwin->w_cursor.col;
+                   /* Only if not already handled by coladvance */
+                   if(restart_edit == NUL)
+                       ++curwin->w_cursor.col;
                    cap->retval |= CA_NO_ADJ_OP_END;
                }
                continue;

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

Raspunde prin e-mail lui