Thursday, May 31, 2012

Re: Weird cursors behaviour when using vim in terminal in insert mode

So you guys thinks it is definitely a bug?

2012/5/31 Christian Brabandt <cblists@256bit.org>:
> On Wed, May 30, 2012 19:29, Gary Johnson wrote:
>> On 2012-05-30, Pablo Giménez wrote:
>>> I have these keymaps for the completion popmenu:
>>>     inoremap <expr> <Esc>      pumvisible() ? "\<C-e>" : "\<Esc>"
>>>     inoremap <expr> <CR>       pumvisible() ? "\<C-y>" : "\<CR>"
>>>     inoremap <expr> <Down>     pumvisible() ? "\<C-n>" : "\<Down>"
>>>     inoremap <expr> <Up>       pumvisible() ? "\<C-p>" : "\<Up>"
>>>     inoremap <expr> <PageDown> pumvisible() ?
>>> "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>"
>>>     inoremap <expr> <PageUp>   pumvisible() ? "\<PageUp>\<C-p>\<C-n>"
>>> : "\<PageUp>"
>>>
>>> I got them from the vim wiki, so I am not sure why they are breaking
>>> my cursors when working from a terminal.
>>> It is supposed that if pop menu is not visible they just return the
>>> same key isnt it?
>>
>> Well, that was easy:  I just executed the first inoremap above and
>> now when I use the arrow keys in insert mode I get A, B, C and D.
>>
>> I don't have time at the moment to look at this more closely, but it
>> looks like possibly a bug.  I can verify that the pumvisible()
>> function is returning the correct values.  It appears that when an
>> Esc arrives in the input buffer, the process of handling it with the
>> inoremap disconnects it from the following characters so that it and
>> the following characters are no longer recognized as an escape
>> sequence.  The behavior might be affected by 'timeout' and/or
>> 'ttimeout', or maybe those options are being ignored when they
>> shouldn't be.
>>
>> Maybe someone with more experience with these mappings can chime in.
>
> I can reproduce the issue with this simple mapping:
> inoremap <Esc> <Esc>
>
> This breaks the cursor keys in terminal vim.
>
> regards,
> Christian
>
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php



--
Un saludo
Best Regards
Pablo Giménez

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: