hterm: ctrl-v-paste logic assumes OS/browser will paste |
||
Issue description
the current ctrl-v keyboard callback assumes that the OS/browser itself normally pastes on that event. so when we implement support for ctrl-v==paste or ctrl-shift-v==paste, we do so by returning hterm.Keyboard.KeyActions.PASS which allows the OS to do the paste. this works for most platforms, but macOS has no default paste shortcut. instead, it has cmd-v for pasting which means our ctrl-v/ctrl-shift-v logic does nothing.
easiest answer is probably to just always handle the paste event ourselves like we do with mouse pasting.
hterm.Keyboard.KeyMap.prototype.onCtrlV_ = function(e, keyDef) {
if ((!e.shiftKey && this.keyboard.ctrlVPaste) ||
(e.shiftKey && !this.keyboard.ctrlVPaste)) {
- return hterm.Keyboard.KeyActions.PASS;
+ this.keyboard.terminal.paste();
+ return hterm.Keyboard.KeyActions.CANCEL;
}
return '\x16';
};
,
Jun 29 2017
this is fixed in hterm-1.66+ and nassh-0.8.36.6+
,
Jul 20 2017
The following revision refers to this bug: https://chromium.googlesource.com/apps/libapps/+/4628ad275e655a68848348bb393f15e3e380d8a1 commit 4628ad275e655a68848348bb393f15e3e380d8a1 Author: Mike Frysinger <vapier@chromium.org> Date: Thu Jul 20 18:03:04 2017 hterm: restore native pasting as a fallback In some environments (notably, "normal" websites), we don't have direct access to read the clipboard (security!). In those cases, our attempt to directly paste ultimately fails breaking ctrl+v shortcuts. Instead, let's plumb the return value of the paste command back up to the callers so they can decide what mitigations to deploy. For mouse pasting, there's nothing we can do but whine. For the keyboard, we can fallback to letting the OS do its thing (and just hope for the best). BUG= chromium:737299 Change-Id: I00847cc6f13132b8486a7e6b850ec790afa8d2e5 Reviewed-on: https://chromium-review.googlesource.com/578849 Reviewed-by: Brandon Gilmore <varz@google.com> Tested-by: Mike Frysinger <vapier@chromium.org> [modify] https://crrev.com/4628ad275e655a68848348bb393f15e3e380d8a1/hterm/js/hterm_keyboard_keymap.js [modify] https://crrev.com/4628ad275e655a68848348bb393f15e3e380d8a1/hterm/js/hterm_terminal.js [modify] https://crrev.com/4628ad275e655a68848348bb393f15e3e380d8a1/hterm/js/hterm.js |
||
►
Sign in to add a comment |
||
Comment 1 by bugdroid1@chromium.org
, Jun 29 2017