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

Bug: After insert-mode completion, Ctrl-Y changes the character before the cursor

Expand Messages
  • Tony Mechelynck
    Bug: After insert-mode completion, Ctrl-Y changes the character before the cursor Reproducible: Always Steps to Reproduce: 1. In Insert mode (after some text),
    Message 1 of 3 , Jul 31, 2007
    • 0 Attachment
      Bug: After insert-mode completion, Ctrl-Y changes the character before
      the cursor

      Reproducible: Always

      Steps to Reproduce:
      1. In Insert mode (after some text), hit Ctrl-N to get a menu of
      possible completions. The first option is filled-in.
      2. Hit backspace to erase the last character, then replace it by a
      value for which there is no completion. The menu disappears, as
      expected.
      3. Hit Ctrl-Y.

      Actual result: the character before the cursor is replaced as if step
      2 above had not occurred. Then (Ctrl-Y) the character from the
      previous line is inserted.

      Expected result: The character from the previous line should have been
      inserted without changing the character typed-in at step 2.

      Additional info:

      Version:
      VIM - Vi IMproved 7.1 (2007 May 12, compiled Jul 30 2007 22:55:28)
      Included patches: 1-46
      Compiled by antoine.mechelynck@...
      Huge version with GTK2-GNOME GUI. Features included (+) or not (-):
      [...]

      Full set of configure options can be seen at
      http://users.skynet.be/antoine.mechelynck/vim/compunix.htm#p1


      Best regards,
      Tony.
      --
      "All flesh is grass"
      -- Isiah
      Smoke a friend today


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Bram Moolenaar
      ... That s not a bug. In insert completion mode CTRL-Y means Yes, accept this match . After typing the backspace and another character you are still in
      Message 2 of 3 , Jul 31, 2007
      • 0 Attachment
        Tony Mechelynck wrote:

        > Bug: After insert-mode completion, Ctrl-Y changes the character before
        > the cursor
        >
        > Reproducible: Always
        >
        > Steps to Reproduce:
        > 1. In Insert mode (after some text), hit Ctrl-N to get a menu of possible
        > completions. The first option is filled-in.
        > 2. Hit backspace to erase the last character, then replace it by a value for
        > which there is no completion. The menu disappears, as expected.
        > 3. Hit Ctrl-Y.
        >
        > Actual result: the character before the cursor is replaced as if step
        > 2 above had not occurred. Then (Ctrl-Y) the character from the
        > previous line is inserted.
        >
        > Expected result: The character from the previous line should have been
        > inserted without changing the character typed-in at step 2.

        That's not a bug. In insert completion mode CTRL-Y means "Yes, accept
        this match". After typing the backspace and another character you are
        still in completion mode, notice the mode message in the last line.

        There was a discussion before (quite a bit of time ago now) what should
        happen when typing a character that makes the list of matches reduce to
        zero. Thinking about a good choice is still in the todo list. For now
        you keep the list of matches, filtered out by the typed text.

        --
        hundred-and-one symptoms of being an internet addict:
        68. Your cat always puts viruses on your dogs homepage

        /// 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
        -~----------~----~----~----~------~----~------~--~---
      • Tony Mechelynck
        ... Hm. So I need to type a space and erase it to make sure I ve left completion; typing something for which there is no match isn t enough. Or is there some
        Message 3 of 3 , Jul 31, 2007
        • 0 Attachment
          Bram Moolenaar wrote:
          >
          > Tony Mechelynck wrote:
          >
          >> Bug: After insert-mode completion, Ctrl-Y changes the character before
          >> the cursor
          >>
          >> Reproducible: Always
          >>
          >> Steps to Reproduce:
          >> 1. In Insert mode (after some text), hit Ctrl-N to get a menu of possible
          >> completions. The first option is filled-in.
          >> 2. Hit backspace to erase the last character, then replace it by a value for
          >> which there is no completion. The menu disappears, as expected.
          >> 3. Hit Ctrl-Y.
          >>
          >> Actual result: the character before the cursor is replaced as if step
          >> 2 above had not occurred. Then (Ctrl-Y) the character from the
          >> previous line is inserted.
          >>
          >> Expected result: The character from the previous line should have been
          >> inserted without changing the character typed-in at step 2.
          >
          > That's not a bug. In insert completion mode CTRL-Y means "Yes, accept
          > this match". After typing the backspace and another character you are
          > still in completion mode, notice the mode message in the last line.
          >
          > There was a discussion before (quite a bit of time ago now) what should
          > happen when typing a character that makes the list of matches reduce to
          > zero. Thinking about a good choice is still in the todo list. For now
          > you keep the list of matches, filtered out by the typed text.
          >

          Hm. So I need to type a space and erase it to make sure I've left completion;
          typing something for which there is no match isn't enough. Or is there some
          magic key to make completion stop, leaving the buffer as it is currently
          displayed above the invisible zero-line menu? Ah, Ctrl-E, but outside of
          completion it means "insert from line below current".

          I can always map

          :inoremap <C-Y> <Space><BS><C-Y>
          :inoremap <C-E> <Space><BS><C-E>

          to disable their "special" function and always insert from the neighbouring
          line (stopping completion if active).

          Not very elegant maybe, but I guess it'll work (taking into account the fact
          that <Space><BS> does nothing in "normal" Insert mode). It may slow down
          repeated Ctrl-Y's though, but I guess I prefer that than noticing -- an hour
          or a week later, or maybe a year later when someone mails me "in such-and-such
          HTML page of yours, there is a broken link at such-and-such a point" -- that
          what I explicitly typed was actually disregarded -- yeah, OK, I should have
          known that Ctrl-Y within completion wasn't the same as i_CTRL-Y but I saw
          nothing under i_CTRL-N or i_CTRL-X_CTRL-N. For once I didn't do my homework --
          started using a feature before studying it completely -- and now I'm sorry. (I
          like the French idiom: "I'm biting my fingers about it".)


          Best regards,
          Tony.
          --
          And yet, seasons must be taken with a grain of salt, for they too have
          a sense of humor, as does history. Corn stalks comedy, comedy stalks
          tragedy, and this too is historic. And yet, still, when corn meets
          tragedy face to face, we have politics.
          -- Dalglish, Larsen and Sutherland, "Root Crops and
          Ground Cover"

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