Handle newline and tab with shift/ctrl modifiers correctly.
commit930f68301918a2772aea3b600be4288b78cc03fc
authorEgmont Koblinger <egmont@gmail.com>
Tue, 1 Oct 2013 10:09:14 +0000 (1 14:09 +0400)
committerAndrew Borodin <aborodin@vmail.ru>
Thu, 3 Oct 2013 07:41:58 +0000 (3 11:41 +0400)
tree918913237c394719333df25caa6cb38fd13c6f10
parent5b4786110120840af5440f47873167bf07627984
Handle newline and tab with shift/ctrl modifiers correctly.

MC already has its own half-ready trick: when pasting with Shift-Insert,
using the X11 extension, the newline ("Enter" as mc calls it) with the
Shift modifier pressed gets converted to a "Return", and in the editor
the Return character inserts a non-indenting newline. This makes pasting
better in terminals not supporting bracketed paste, however, it has some
problems that this commit addresses:

  * Shift+newline gets this special treatment, but Ctrl+newline gets
    dropped. Hence e.g. when pasting in Gnome-terminal with Ctrl+Shift+V
    all the newlines will be missing. This commit adds the same
    non-indenting newline behavior to Ctrl+Newline and Ctrl+Shift+Newline.

  * The code forgets about Tab that also needs special treatment:

    - Most terminals send \e[Z on Shift+Tab, this is not handled by MC
      at all, moreover it causes a hang for about a second. This commit
      teaches this sequence to MC. This is especially useful when no X11
      is available, because there Ctrl+Tab is identical to Tab, so the
      backwards tab feature is not available. With this commit Shift+Tab
      becomes a backwards tab too on all terminals that emit \e[Z.

    - When pasting to the editor, Shift+Tab, Ctrl+Tab and Ctrl+Shift+Tab
      should all insert a tab for the same reason mentioned at the newline.

    - It would look inconsistent in the keymap files to have logical code
      such as "backtab" instead of "shift-tab" and friends, hence get rid
      of KEY_BTAB and use KEY_M_SHIFT | '\t' instead.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
lib/tty/key.c
lib/widget/dialog.c
misc/mc.default.keymap
misc/mc.emacs.keymap
src/keybind-defaults.c