Hello, 

I am trying to extend the Applidium port of vim to iOS. 

Specifically, I'm trying to add support of external keyboards (the iPad is 
great, but it's even more useful with an external keyboard. Especially, since 
it's vim, one with an "Esc" key). 

I have code for catching keyboard events, and I can identify them (I know if 
Control has been pressed, or Alt, and with which keys). I also identify the 
special keys, such as up, down…

I think I've found the way to pass the events to vim. For function keys, cursor 
keys, all is fine. 

I'm having trouble with control + key (and alt + key). Here's my code: 

        // Identify the modifiers (Shift, Ctrl, Alt, Option)
        UInt32 vimModifiers = EventFlags2VimModifiers(eventFlags);
        // Are we on a special key?
        int isSpecial = 0;
        int i;
        int     key_char;
        for (i = 0; special_keys[i].key_sym != (KeySym)0; ++i)
            if (special_keys[i].key_sym == keycode[0])
            {
                key_char = TO_SPECIAL(special_keys[i].vim_code0,
                                      special_keys[i].vim_code1);
                key_char = simplify_key(key_char, (int *)&vimModifiers);
                isSpecial = TRUE;
                break;
            }
        
        if (vimModifiers)
        {
            // We place the modifiers in the buffer
            result[len++] = CSI;
            result[len++] = KS_MODIFIER;
            result[len++] = vimModifiers;
        }
        
        if (isSpecial && IS_SPECIAL(key_char))
        {
            result[len++] = CSI;
            result[len++] = K_SECOND(key_char);
            result[len++] = K_THIRD(key_char);
        } else if (vimModifiers) {
            result[len++] = keycode[0] + 0x5d; // convert key code to letter
            result[len++] = 0;
        }
        if (len > 0) {
            add_to_input_buf(result, len);
        }

When I type control + A, I get the standard behavior for control + A (insert 
previously inserted text) *plus* the letter a, appended at the end.
(same for all letters, so for example control + V ends up as only "visual", not 
"visual block") 

And I can't figure why. My first guess is that there is something wrong in the 
way I handle modified letters, but I couldn't find any documentation as to how 
to do it (I got this far by looking at the code for other platforms). 

Could you point me towards the right documentation?
N Holzschuch


-- 
You received this message from the "vim_dev" 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

Raspunde prin e-mail lui