Ticket #2662: mc-4.8.0-extended-mouse-broke-ctrl-space.patch

File mc-4.8.0-extended-mouse-broke-ctrl-space.patch, 3.3 KB (added by egmont, 7 years ago)

fix for the ctrl+space bug

  • lib/tty/key.c

    diff -ur mc-4.8.0.orig/lib/tty/key.c mc-4.8.0/lib/tty/key.c
    old new  
    932932 
    933933/* --------------------------------------------------------------------------------------------- */ 
    934934/* Parse extended mouse coordinates. 
    935    Returns -1 if pending_keys cannot be a prefix of extended mouse coordinates. 
    936    Returns 0 if pending_keys is a valid (but still incomplete) prefix for extended mouse 
    937    coordinates, e.g. "^[[32;4". 
    938    Returns 1 and fills the mouse_btn, mouse_x, mouse_y values if pending_keys is a complete extended 
    939    mouse sequence, e.g. "^[[32;42;5M" 
     935   Returns -1 if pending_keys (up to seq_append) cannot be a prefix of extended mouse coordinates. 
     936   Returns 0 if pending_keys (up to seq_append) is a valid (but still incomplete) prefix for 
     937   extended mouse coordinates, e.g. "^[[32;4". 
     938   Returns 1 and fills the mouse_btn, mouse_x, mouse_y values if pending_keys (up to seq_append) is 
     939   a complete extended mouse sequence, e.g. "^[[32;42;5M" 
    940940 */ 
    941941 
    942942/* Technical info (Egmont Koblinger <egmont@gmail.com>): 
    943943 
    944    The ancient way of reporting mouse coordinates only supports coordinates up to 231, 
     944   The ancient way of reporting mouse coordinates only supports coordinates up to 223, 
    945945   so if your terminal is wider (or taller, but that's unlikely), you cannot use your mouse 
    946946   in the rightmost columns. 
    947947 
     
    951951          <x+32> and <y+32> are single bytes. (Action is 0 for left click, 1 for middle click, 
    952952          2 for right click, 3 for release, or something like this.) 
    953953        + Disadvantages of this format: 
    954             + x and y can only go up to 231. 
     954            + x and y can only go up to 223. 
    955955            + Coordinates above 95 are not ascii-compatible, so any character set converting 
    956956              layer (e.g. luit) messes them up. 
    957957            + The stream is not valid UTF-8, even if everything else is. 
     
    988988    Currently, at least the following terminal emulators have support for these: 
    989989    * xterm supports the xterm extension 
    990990    * rxvt-unicode >= 9.10 supports both extensions 
    991     * iterm2 supports both extensions. 
     991    * iterm2 supports both extensions 
     992    * vte >= 0.31 supports the urxvt extension 
    992993*/ 
    993994 
    994995static int 
     
    996997{ 
    997998    int c, btn = 0, x = 0, y = 0; 
    998999    const int *p = pending_keys; 
     1000    const int *endp = seq_append; 
    9991001 
    1000     c = *p++; 
    1001     if (c == 0) 
     1002    if (p == endp) 
    10021003        return 0; 
     1004    c = *p++; 
    10031005    if (c != ESC_CHAR) 
    10041006        return -1; 
    10051007 
    1006     c = *p++; 
    1007     if (c == 0) 
     1008    if (p == endp) 
    10081009        return 0; 
     1010    c = *p++; 
    10091011    if (c != '[') 
    10101012        return -1; 
    10111013 
    10121014    while (TRUE) 
    10131015    { 
    1014         c = *p++; 
    1015         if (c == 0) 
     1016        if (p == endp) 
    10161017            return 0; 
     1018        c = *p++; 
    10171019        if (c == ';') 
    10181020            break; 
    10191021        if (c < '0' || c > '9') 
     
    10261028 
    10271029    while (TRUE) 
    10281030    { 
    1029         c = *p++; 
    1030         if (c == 0) 
     1031        if (p == endp) 
    10311032            return 0; 
     1033        c = *p++; 
    10321034        if (c == ';') 
    10331035            break; 
    10341036        if (c < '0' || c > '9') 
     
    10401042 
    10411043    while (TRUE) 
    10421044    { 
    1043         c = *p++; 
    1044         if (c == 0) 
     1045        if (p == endp) 
    10451046            return 0; 
     1047        c = *p++; 
    10461048        if (c == 'M') 
    10471049            break; 
    10481050        if (c < '0' || c > '9')