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