mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
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:
+10
-1
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user