Skip to content

Commit

Permalink
make scroll-on-input behaviour configurable (fixes #543)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Dec 10, 2018
1 parent c58c629 commit f32bdbd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ h3.mb-3 Terminal
[(ngModel)]='config.store.terminal.copyOnSelect',
(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
.header
Expand Down
8 changes: 5 additions & 3 deletions terminus-terminal/src/components/terminalTab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ export class TerminalTabComponent extends BaseTabComponent {
let wheelDeltaY = 0

if ('wheelDeltaY' in event) {
wheelDeltaY = (event as MouseWheelEvent)["wheelDeltaY"]
wheelDeltaY = (event as MouseWheelEvent).wheelDeltaY
} else {
wheelDeltaY = (event as MouseWheelEvent)["deltaY"]
wheelDeltaY = (event as MouseWheelEvent).deltaY
}
if (event.ctrlKey || event.metaKey) {

Expand Down Expand Up @@ -300,7 +300,9 @@ export class TerminalTabComponent extends BaseTabComponent {

sendInput (data: string) {
this.session.write(data)
this.frontend.scrollToBottom()
if (this.config.store.terminal.scrollOnInput) {
this.frontend.scrollToBottom()
}
}

write (data: string) {
Expand Down
1 change: 1 addition & 0 deletions terminus-terminal/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class TerminalConfigProvider extends ConfigProvider {
customShell: '',
rightClick: 'menu',
copyOnSelect: false,
scrollOnInput: true,
workingDirectory: '',
altIsMeta: false,
colorScheme: {
Expand Down
2 changes: 2 additions & 0 deletions terminus-terminal/src/frontends/htermFrontend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ export class HTermFrontend extends Frontend {
preferenceManager.set('pass-alt-number', true)
preferenceManager.set('cursor-blink', config.terminal.cursorBlink)
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) {
preferenceManager.set('foreground-color', config.terminal.colorScheme.foreground)
Expand Down

0 comments on commit f32bdbd

Please sign in to comment.