Ticket #2661: mc-4.8.10-editor-paste-newline-tab.patch

File mc-4.8.10-editor-paste-newline-tab.patch, 4.1 KB (added by egmont, 9 years ago)

Handle newline and tab with shift/ctrl modifiers correctly

  • lib/tty/key.c

    diff -ur mc-4.8.10.orig/lib/tty/key.c mc-4.8.10/lib/tty/key.c
    old new  
    326326    {KEY_M_SHIFT | KEY_M_CTRL | KEY_DOWN, ESC_STR "[1;6B", MCKEY_NOACTION}, 
    327327    {KEY_M_SHIFT | KEY_M_CTRL | KEY_RIGHT, ESC_STR "[1;6C", MCKEY_NOACTION}, 
    328328    {KEY_M_SHIFT | KEY_M_CTRL | KEY_LEFT, ESC_STR "[1;6D", MCKEY_NOACTION}, 
     329    {KEY_M_SHIFT | '\t', ESC_STR "[Z", MCKEY_NOACTION}, 
    329330 
    330331    /* putty */ 
    331332    {KEY_M_SHIFT | KEY_M_CTRL | KEY_UP, ESC_STR "[[1;6A", MCKEY_NOACTION}, 
     
    10081009    if (c == KEY_SCANCEL) 
    10091010        c = '\t'; 
    10101011 
    1011     /* Convert Shift+Tab and Ctrl+Tab to Back Tab 
    1012      * only if modifiers directly from X11 
    1013      */ 
    1014 #ifdef HAVE_TEXTMODE_X11_SUPPORT 
    1015     if (x11_window != 0) 
    1016 #endif /* HAVE_TEXTMODE_X11_SUPPORT */ 
    1017     { 
    1018         if ((c == '\t') && (mod & (KEY_M_SHIFT | KEY_M_CTRL))) 
    1019         { 
    1020             c = KEY_BTAB; 
    1021             mod = 0; 
    1022         } 
     1012    /* Convert Back Tab to Shift+Tab */ 
     1013    if (c == KEY_BTAB) { 
     1014        c = '\t'; 
     1015        mod = KEY_M_SHIFT; 
    10231016    } 
    10241017 
    10251018    /* F0 is the same as F10 for out purposes */ 
  • lib/widget/dialog.c

    diff -ur mc-4.8.10.orig/lib/widget/dialog.c mc-4.8.10/lib/widget/dialog.c
    old new  
    493493            dlg_one_down (h); 
    494494            return; 
    495495        } 
    496         else if (d_key == KEY_BTAB) 
     496        else if ((d_key & ~(KEY_M_SHIFT | KEY_M_CTRL)) == '\t') 
    497497        { 
    498498            dlg_one_up (h); 
    499499            return; 
  • misc/mc.default.keymap

    diff -ur mc-4.8.10.orig/misc/mc.default.keymap mc-4.8.10/misc/mc.default.keymap
    old new  
    227227WordLeft = ctrl-left; ctrl-z 
    228228WordRight = ctrl-right; ctrl-x 
    229229Enter = enter 
    230 Return = shift-enter 
     230Return = shift-enter; ctrl-enter; ctrl-shift-enter 
    231231BackSpace = backspace; ctrl-h 
    232232Delete = delete; ctrl-d 
    233233PageUp = pgup 
    234234PageDown = pgdn 
    235235Home = home 
    236236End = end 
    237 Tab = tab 
     237Tab = tab; shift-tab; ctrl-tab; ctrl-shift-tab 
    238238Undo = ctrl-u 
    239239Redo = alt-r 
    240240Top = ctrl-home; alt-lt 
  • misc/mc.emacs.keymap

    diff -ur mc-4.8.10.orig/misc/mc.emacs.keymap mc-4.8.10/misc/mc.emacs.keymap
    old new  
    227227WordLeft = ctrl-left; alt-b 
    228228WordRight = ctrl-right; alt-f 
    229229Enter = enter 
    230 Return = shift-enter 
     230Return = shift-enter; ctrl-enter; ctrl-shift-enter 
    231231BackSpace = backspace 
    232232Delete = delete 
    233233PageUp = pgup; alt-v 
    234234PageDown = pgdn; ctrl-v 
    235235Home = home; ctrl-a 
    236236End = end; ctrl-e 
    237 Tab = tab 
     237Tab = tab; shift-tab ctrl-tab; ctrl-shift-tab 
    238238Undo = ctrl-u 
    239239# Redo = 
    240240Top = ctrl-home; alt-lt 
  • misc/mc.keymap

    diff -ur mc-4.8.10.orig/misc/mc.keymap mc-4.8.10/misc/mc.keymap
    old new  
    227227WordLeft = ctrl-left; ctrl-z 
    228228WordRight = ctrl-right; ctrl-x 
    229229Enter = enter 
    230 Return = shift-enter 
     230Return = shift-enter; ctrl-enter; ctrl-shift-enter 
    231231BackSpace = backspace; ctrl-h 
    232232Delete = delete; ctrl-d 
    233233PageUp = pgup 
    234234PageDown = pgdn 
    235235Home = home 
    236236End = end 
    237 Tab = tab 
     237Tab = tab; shift-tab; ctrl-tab; ctrl-shift-tab 
    238238Undo = ctrl-u 
    239239Redo = alt-r 
    240240Top = ctrl-home; alt-lt 
  • src/keybind-defaults.c

    diff -ur mc-4.8.10.orig/src/keybind-defaults.c mc-4.8.10/src/keybind-defaults.c
    old new  
    320320#ifdef USE_INTERNAL_EDIT 
    321321static const global_keymap_ini_t default_editor_keymap[] = { 
    322322    {"Enter", "enter"}, 
    323     {"Return", "shift-enter"},  /* useful for pasting multiline text */ 
    324     {"Tab", "tab"}, 
     323    {"Return", "shift-enter; ctrl-enter; ctrl-shift-enter"},  /* useful for pasting multiline text */ 
     324    {"Tab", "tab; shift-tab; ctrl-tab; ctrl-shift-tab"},  /* ditto */ 
    325325    {"BackSpace", "backspace; ctrl-h"}, 
    326326    {"Delete", "delete; ctrl-d"}, 
    327327    {"Left", "left"},