Fix Ctrl/Shift + insert copy/paste

Many systems (including MS Windows and many linuxes) map `<Ctrl>` +
`<Insert>` to copy and `<Shift> + <Insert>` to paste. That serves as a
handy fallback when the more common `<Ctrl> + C` and `<Ctrl> + V`
keybindings have their default prevented to send signals to the
terminal.

Currently all keydown-events with the insert key send `\x1b[2~` to the
terminal. This commit won't send that key if either the `shiftKey` or
the `ctrlKey` are present. Instead it will enable `contentEditable` to
allow for pasting.
This commit is contained in:
runarberg
2016-06-09 13:45:02 +00:00
parent cf9d2348a1
commit 524db02228
+10 -1
View File
@@ -519,6 +519,11 @@
term.leaseContentEditable();
}
}
if (!term.isMac && ev.keyCode == 45 && ev.shiftKey && !ev.ctrlKey) {
// Shift + Insert pastes on windows and many linuxes
term.leaseContentEditable();
}
});
/**
@@ -2387,7 +2392,11 @@
break;
// insert
case 45:
key = '\x1b[2~';
if (!ev.shiftKey && !ev.ctrlKey) {
// <Ctrl> or <Shift> + <Insert> are used to
// copy-paste on some systems.
key = '\x1b[2~';
}
break;
// home
case 36: