Loading ...
Sorry, an error occurred while loading the content.

Re: Reproducible SEGV when deleting over BOL using i_CTRL-o

Expand Messages
  • Bram Moolenaar
    ... I can reproduce it. Thanks for making a patch! I ll check that this is the best way to solve it. -- hundred-and-one symptoms of being an internet addict:
    Message 1 of 3 , Oct 31, 2007
    • 0 Attachment
      Matthew Wozniski wrote:

      > 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.

      I can reproduce it. Thanks for making a patch! I'll check that this is
      the best way to solve it.

      --
      hundred-and-one symptoms of being an internet addict:
      71. You wonder how people walk

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

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    Your message has been successfully submitted and would be delivered to recipients shortly.