make scroll-on-input behaviour configurable (fixes #543)

This commit is contained in:
Eugene Pankov
2018-12-10 11:57:13 +01:00
parent c58c629d0e
commit f32bdbdeac
4 changed files with 17 additions and 3 deletions

View File

@@ -83,6 +83,15 @@ h3.mb-3 Terminal
(ngModelChange)='config.save()', (ngModelChange)='config.save()',
) )
.form-line
.header
.title Scroll on input
.description Scrolls the terminal to the bottom on user input
toggle(
[(ngModel)]='config.store.terminal.scrollOnInput',
(ngModelChange)='config.save()',
)
.form-line .form-line
.header .header
.title Use Alt key as the Meta key .title Use Alt key as the Meta key

View File

@@ -264,9 +264,9 @@ export class TerminalTabComponent extends BaseTabComponent {
let wheelDeltaY = 0 let wheelDeltaY = 0
if ('wheelDeltaY' in event) { if ('wheelDeltaY' in event) {
wheelDeltaY = (event as MouseWheelEvent)["wheelDeltaY"] wheelDeltaY = (event as MouseWheelEvent).wheelDeltaY
} else { } else {
wheelDeltaY = (event as MouseWheelEvent)["deltaY"] wheelDeltaY = (event as MouseWheelEvent).deltaY
} }
if (event.ctrlKey || event.metaKey) { if (event.ctrlKey || event.metaKey) {
@@ -300,7 +300,9 @@ export class TerminalTabComponent extends BaseTabComponent {
sendInput (data: string) { sendInput (data: string) {
this.session.write(data) this.session.write(data)
this.frontend.scrollToBottom() if (this.config.store.terminal.scrollOnInput) {
this.frontend.scrollToBottom()
}
} }
write (data: string) { write (data: string) {

View File

@@ -21,6 +21,7 @@ export class TerminalConfigProvider extends ConfigProvider {
customShell: '', customShell: '',
rightClick: 'menu', rightClick: 'menu',
copyOnSelect: false, copyOnSelect: false,
scrollOnInput: true,
workingDirectory: '', workingDirectory: '',
altIsMeta: false, altIsMeta: false,
colorScheme: { colorScheme: {

View File

@@ -72,6 +72,8 @@ export class HTermFrontend extends Frontend {
preferenceManager.set('pass-alt-number', true) preferenceManager.set('pass-alt-number', true)
preferenceManager.set('cursor-blink', config.terminal.cursorBlink) preferenceManager.set('cursor-blink', config.terminal.cursorBlink)
preferenceManager.set('clear-selection-after-copy', true) preferenceManager.set('clear-selection-after-copy', true)
preferenceManager.set('scroll-on-output', false)
preferenceManager.set('scroll-on-keystroke', config.terminal.scrollOnInput)
if (config.terminal.colorScheme.foreground) { if (config.terminal.colorScheme.foreground) {
preferenceManager.set('foreground-color', config.terminal.colorScheme.foreground) preferenceManager.set('foreground-color', config.terminal.colorScheme.foreground)