-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add terminal scroll commands. #7179
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,33 @@ export namespace TerminalCommands { | |
category: TERMINAL_CATEGORY, | ||
label: 'Hide find widget' | ||
}; | ||
|
||
export const SCROLL_LINE_UP: Command = { | ||
id: 'terminal:scroll:line:up', | ||
category: TERMINAL_CATEGORY, | ||
label: 'Scroll line up' | ||
}; | ||
export const SCROLL_LINE_DOWN: Command = { | ||
id: 'terminal:scroll:line:down', | ||
category: TERMINAL_CATEGORY, | ||
label: 'Scroll line down' | ||
}; | ||
export const SCROLL_TO_TOP: Command = { | ||
id: 'terminal:scroll:top', | ||
category: TERMINAL_CATEGORY, | ||
label: 'Scroll to top' | ||
}; | ||
export const SCROLL_PAGE_UP: Command = { | ||
id: 'terminal:scroll:page:up', | ||
category: TERMINAL_CATEGORY, | ||
label: 'Scroll page up' | ||
}; | ||
export const SCROLL_PAGE_DOWN: Command = { | ||
id: 'terminal:scroll:page:down', | ||
category: TERMINAL_CATEGORY, | ||
label: 'Scroll page down' | ||
}; | ||
|
||
/** | ||
* Command that displays all terminals that are currently opened | ||
*/ | ||
|
@@ -244,6 +271,42 @@ export class TerminalFrontendContribution implements TerminalService, CommandCon | |
terminalSearchBox.hide(); | ||
} | ||
}); | ||
|
||
commands.registerCommand(TerminalCommands.SCROLL_LINE_UP, { | ||
isEnabled: () => this.shell.activeWidget instanceof TerminalWidget, | ||
isVisible: () => false, | ||
execute: () => { | ||
(this.shell.activeWidget as TerminalWidget).scrollLineUp(); | ||
} | ||
}); | ||
commands.registerCommand(TerminalCommands.SCROLL_LINE_DOWN, { | ||
isEnabled: () => this.shell.activeWidget instanceof TerminalWidget, | ||
isVisible: () => false, | ||
execute: () => { | ||
(this.shell.activeWidget as TerminalWidget).scrollLineDown(); | ||
} | ||
}); | ||
commands.registerCommand(TerminalCommands.SCROLL_TO_TOP, { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AndrienkoAleksandr are we missing the keybinding for the opposite There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello. I don't know how, but it already works by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That's what I noticed as well, End already worked correctly, perhaps we can omit it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree, I think we can omit it. If somebody will report issue, we can fix it easily. |
||
isEnabled: () => this.shell.activeWidget instanceof TerminalWidget, | ||
isVisible: () => false, | ||
execute: () => { | ||
(this.shell.activeWidget as TerminalWidget).scrollToTop(); | ||
} | ||
}); | ||
commands.registerCommand(TerminalCommands.SCROLL_PAGE_UP, { | ||
isEnabled: () => this.shell.activeWidget instanceof TerminalWidget, | ||
isVisible: () => false, | ||
execute: () => { | ||
(this.shell.activeWidget as TerminalWidget).scrollPageUp(); | ||
} | ||
}); | ||
commands.registerCommand(TerminalCommands.SCROLL_PAGE_DOWN, { | ||
isEnabled: () => this.shell.activeWidget instanceof TerminalWidget, | ||
isVisible: () => false, | ||
execute: () => { | ||
(this.shell.activeWidget as TerminalWidget).scrollPageDown(); | ||
} | ||
}); | ||
} | ||
|
||
registerMenus(menus: MenuModelRegistry): void { | ||
|
@@ -291,12 +354,36 @@ export class TerminalFrontendContribution implements TerminalService, CommandCon | |
keybinding: 'ctrlcmd+f', | ||
context: TerminalKeybindingContexts.terminalActive | ||
}); | ||
|
||
keybindings.registerKeybinding({ | ||
command: TerminalCommands.TERMINAL_FIND_TEXT_CANCEL.id, | ||
keybinding: 'esc', | ||
context: TerminalKeybindingContexts.terminalHideSearch | ||
}); | ||
keybindings.registerKeybinding({ | ||
command: TerminalCommands.SCROLL_LINE_UP.id, | ||
keybinding: 'ctrl+shift+up', | ||
context: TerminalKeybindingContexts.terminalActive | ||
}); | ||
keybindings.registerKeybinding({ | ||
command: TerminalCommands.SCROLL_LINE_DOWN.id, | ||
keybinding: 'ctrl+shift+down', | ||
context: TerminalKeybindingContexts.terminalActive | ||
}); | ||
keybindings.registerKeybinding({ | ||
command: TerminalCommands.SCROLL_TO_TOP.id, | ||
keybinding: 'home', | ||
context: TerminalKeybindingContexts.terminalActive | ||
}); | ||
keybindings.registerKeybinding({ | ||
command: TerminalCommands.SCROLL_PAGE_UP.id, | ||
keybinding: 'pageUp', | ||
context: TerminalKeybindingContexts.terminalActive | ||
}); | ||
keybindings.registerKeybinding({ | ||
command: TerminalCommands.SCROLL_PAGE_DOWN.id, | ||
keybinding: 'pageDown', | ||
context: TerminalKeybindingContexts.terminalActive | ||
}); | ||
|
||
/* Register passthrough keybindings for combinations recognized by | ||
xterm.js and converted to control characters. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A breaking change note is required (
changelog
) for these newabstract
methods.Anyone currently implementing
TerminalWidget
will be broken by the following changes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nobody should implement
TerminalWidget
, we should rather get rid of boilerplate interface later: https://github.com/eclipse-theia/theia/wiki/Coding-Guidelines#classes-over-interfacesIn other words it looks fine if it is not optional.