Why aren't VS Code's default keybindings for scrolling an integrated terminal by line working?

69 Views Asked by At

I am using Visual Studio Code, which I like quite a lot except for one thing: It puts output in a middle window between the code and the command line and I can't get this to scroll. It's the area above the command line and below the output, debug, terminal, etc., tabs: enter image description here

This thread points out that there are keyboard shortcuts for scrolling. They show up in my preferences but they have no effect when I try them. When I use the scroll wheel on my mouse it scrolls through command history on the command line. Anyone know how to solve this problem? It's a little astonishing that MS didn't put a scroll bar on that middle window.

1

There are 1 best solutions below

0
On

I can reproduce the problem. Other keyboard shortcuts are taking higher priority: workbench.action.terminal.selectToPreviousCommand and workbench.action.terminal.selectToNextCommand over the workbench.action.terminal.scrollUp and workbench.action.terminal.scrollDown that you want. Note that you can figure this stuff out on your own by troubleshooting your keybindings. Honestly, this seems like weird behaviour and possibly a mistake in VS Code. Not sure.

To get around this, you can either rebind things to non-conflicting keys, or maybe fiddle with when clauses, but the simplest thing would be to just unbind workbench.action.terminal.selectToPreviousCommand and workbench.action.terminal.selectToNextCommand (and then rebind them to something else if you still want them). You could unbind them by putting the following in your keybindings.json file (which you can open using the Preferences: Open Keyboard Shortcuts (JSON) in the command palette):

{
    "key": "ctrl+shift+up",
    "command": "-workbench.action.terminal.selectToPreviousCommand",
    "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
},
{
    "key": "ctrl+shift+down",
    "command": "-workbench.action.terminal.selectToNextCommand",
    "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
},