Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #497 from learn-co/scroll
Browse files Browse the repository at this point in the history
Include legacy scroll shortcut on Mac
  • Loading branch information
drewprice authored Jun 21, 2017
2 parents 4d999cb + ed5c635 commit 5ebcf89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion keymaps/learn-ide.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"cmd--": "learn-ide:decrease-font-size",
"cmd-0": "learn-ide:reset-font-size",
"cmd-up": "learn-ide:scroll-up",
"cmd-down": "learn-ide:scroll-down"
"cmd-down": "learn-ide:scroll-down",
"ctrl-alt-up": "learn-ide:scroll-up",
"ctrl-alt-down": "learn-ide:scroll-down"
},
".platform-win32 .terminal, .platform-linux .terminal": {
"ctrl-=": "learn-ide:increase-font-size",
Expand Down
9 changes: 6 additions & 3 deletions lib/terminal-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,16 @@ class TerminalView extends View {
return ctrlKey && (keyCode === 83) && (process.platform !== 'darwin')
}

isAttemptToScroll({keyCode, ctrlKey, metaKey}) {
isAttemptToScroll({keyCode, ctrlKey, metaKey, altKey}) {
var isUpOrDown = [38, 40].includes(keyCode);

if (!isUpOrDown) { return false }

// cmd-up/down on mac, or ctrl-up/down on windows and linux
return process.platform === 'darwin' ? metaKey : ctrlKey
// ctrl-up/down on windows and linux
if (process.platform !== 'darwin') { return ctrlKey }

// cmd-up/down or ctrl-alt-up/down on mac
return metaKey || (ctrlKey && altKey)
}

loadPopoutEmulator() {
Expand Down

0 comments on commit 5ebcf89

Please sign in to comment.