Support Shift+Up/Down keys in notebook outputs (#209314)

This commit is contained in:
Don Jayamanne 2024-04-02 20:02:37 +11:00 committed by GitHub
parent 166a042fcc
commit 78cfeea7ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -311,6 +311,13 @@ async function webviewPreloads(ctx: PreloadContext) {
if (!lastFocusedOutput?.id || !e.shiftKey) {
return;
}
// If we're pressing `Shift+Up/Down` then we want to select a line at a time.
if (e.shiftKey && (e.code === 'ArrowUp' || e.code === 'ArrowDown')) {
e.stopPropagation(); // We don't want the notebook to handle this, default behavior is what we need.
return;
}
// We want to handle just `Shift + PageUp/PageDown` & `Shift + Cmd + ArrowUp/ArrowDown` (for mac)
if (!(e.code === 'PageUp' || e.code === 'PageDown') && !(e.metaKey && (e.code === 'ArrowDown' || e.code === 'ArrowUp'))) {
return;