Ticket #287: multi-press-f-keys.patch

File multi-press-f-keys.patch, 1.6 KB (added by sbrabec, 15 years ago)

multi-press-f-keys.patch

  • src/key.c

    http://www.midnight-commander.org/ticket/287
    old new  
    694694    /* F0 is the same as F10 for out purposes */ 
    695695    if (c == KEY_F (0)) 
    696696        c = KEY_F (10); 
     697    if (c == KEY_F_IMMUTABLE (0)) 
     698        c = KEY_F_IMMUTABLE (10); 
    697699 
    698700    /* 
    699701     * We are not interested if Ctrl was pressed when entering control 
     
    765767        mod &= ~KEY_M_SHIFT; 
    766768    } 
    767769 
     770    /* 
     771     * Numerals may require modifilers with some keymaps or on obscure 
     772     * keyboards (e. g. F4 = Esc Shift+4). We have to ignore all 
     773     * modifiers while interpreting Esc + Numeral. 
     774     */ 
     775    if (c >= KEY_F_IMMUTABLE (1) && c <= KEY_F_IMMUTABLE (10)) { 
     776        c += KEY_F (0) - KEY_F_IMMUTABLE (0); 
     777        mod &= ~KEY_M_MASK; 
     778    } 
     779 
    768780    if (!alternate_plus_minus) 
    769781        switch (c) { 
    770782        case KEY_KP_ADD: 
     
    917929                this = this->next; 
    918930            else { 
    919931                if (parent != NULL && parent->action == MCKEY_ESCAPE) { 
    920  
    921932                    /* Convert escape-digits to F-keys */ 
    922933                    if (isdigit(c)) 
    923                         c = KEY_F (c - '0'); 
     934                        c = KEY_F_IMMUTABLE (c - '0'); 
    924935                    else if (c == ' ') 
    925936                        c = ESC_CHAR; 
    926937                    else 
  • src/myslang.h

    old new  
    2929}; 
    3030 
    3131#define KEY_F(x) (1000+x) 
     32#define KEY_F_IMMUTABLE(x) (970+x) 
    3233 
    3334#define ACS_VLINE SLSMG_VLINE_CHAR 
    3435#define ACS_HLINE SLSMG_HLINE_CHAR