From 444d92d393eefe658bb8bcfe6b918aff65ec4033 Mon Sep 17 00:00:00 2001 From: matishadow Date: Thu, 8 Oct 2020 19:30:57 +0200 Subject: [PATCH 01/19] Add possibility to configure always enabled regex --- terminus-terminal/src/components/searchPanel.component.ts | 3 +++ .../src/components/terminalSettingsTab.component.pug | 8 ++++++++ terminus-terminal/src/config.ts | 1 + 3 files changed, 12 insertions(+) diff --git a/terminus-terminal/src/components/searchPanel.component.ts b/terminus-terminal/src/components/searchPanel.component.ts index 2e9a8dae..31d07766 100644 --- a/terminus-terminal/src/components/searchPanel.component.ts +++ b/terminus-terminal/src/components/searchPanel.component.ts @@ -1,6 +1,7 @@ import { Component, Input, Output, EventEmitter } from '@angular/core' import { ToastrService } from 'ngx-toastr' import { Frontend, SearchOptions } from '../frontends/frontend' +import {ConfigService} from "terminus-core"; @Component({ selector: 'search-panel', @@ -13,12 +14,14 @@ export class SearchPanelComponent { notFound = false options: SearchOptions = { incremental: true, + regex: this.config.store.terminal.searchRegexAlwaysEnabled, } @Output() close = new EventEmitter() constructor ( private toastr: ToastrService, + public config: ConfigService, ) { } onQueryChange (): void { diff --git a/terminus-terminal/src/components/terminalSettingsTab.component.pug b/terminus-terminal/src/components/terminalSettingsTab.component.pug index 481f1121..ec653284 100644 --- a/terminus-terminal/src/components/terminalSettingsTab.component.pug +++ b/terminus-terminal/src/components/terminalSettingsTab.component.pug @@ -116,6 +116,14 @@ h3.mb-3 Terminal [(ngModel)]='config.store.terminal.scrollOnInput', (ngModelChange)='config.save()', ) + +.form-line + .header + .title Regex in search always enabled + toggle( + [(ngModel)]='config.store.terminal.searchRegexAlwaysEnabled', + (ngModelChange)='config.save()', + ) .form-line .header diff --git a/terminus-terminal/src/config.ts b/terminus-terminal/src/config.ts index 9511981d..c779af2e 100644 --- a/terminus-terminal/src/config.ts +++ b/terminus-terminal/src/config.ts @@ -65,6 +65,7 @@ export class TerminalConfigProvider extends ConfigProvider { recoverTabs: true, warnOnMultilinePaste: true, showDefaultProfiles: true, + searchRegexAlwaysEnabled: false, }, } From 8e4c36ec24646c9b6b961ef59c49d566ddd116cc Mon Sep 17 00:00:00 2001 From: matishadow Date: Thu, 8 Oct 2020 19:53:13 +0200 Subject: [PATCH 02/19] Fix lint problems --- terminus-terminal/src/components/searchPanel.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminus-terminal/src/components/searchPanel.component.ts b/terminus-terminal/src/components/searchPanel.component.ts index 31d07766..a5bf3c08 100644 --- a/terminus-terminal/src/components/searchPanel.component.ts +++ b/terminus-terminal/src/components/searchPanel.component.ts @@ -1,7 +1,7 @@ import { Component, Input, Output, EventEmitter } from '@angular/core' import { ToastrService } from 'ngx-toastr' import { Frontend, SearchOptions } from '../frontends/frontend' -import {ConfigService} from "terminus-core"; +import { ConfigService } from 'terminus-core' @Component({ selector: 'search-panel', From afd6ce43463def0b33d3184c0e1f28ba28a10de1 Mon Sep 17 00:00:00 2001 From: matishadow Date: Thu, 22 Oct 2020 19:48:28 +0200 Subject: [PATCH 03/19] Remove RegexAlwaysEnabled from settings component --- .../src/components/terminalSettingsTab.component.pug | 8 -------- 1 file changed, 8 deletions(-) diff --git a/terminus-terminal/src/components/terminalSettingsTab.component.pug b/terminus-terminal/src/components/terminalSettingsTab.component.pug index ec653284..3314af10 100644 --- a/terminus-terminal/src/components/terminalSettingsTab.component.pug +++ b/terminus-terminal/src/components/terminalSettingsTab.component.pug @@ -117,14 +117,6 @@ h3.mb-3 Terminal (ngModelChange)='config.save()', ) -.form-line - .header - .title Regex in search always enabled - toggle( - [(ngModel)]='config.store.terminal.searchRegexAlwaysEnabled', - (ngModelChange)='config.save()', - ) - .form-line .header .title Use Alt key as the Meta key From 358d9f30d2ff09de7d5bf1a50083f568bda0c510 Mon Sep 17 00:00:00 2001 From: matishadow Date: Thu, 22 Oct 2020 23:35:23 +0200 Subject: [PATCH 04/19] Make search options be remembered --- .../src/components/searchPanel.component.pug | 6 +++--- .../src/components/searchPanel.component.ts | 12 ++++++++++-- terminus-terminal/src/config.ts | 5 +++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/terminus-terminal/src/components/searchPanel.component.pug b/terminus-terminal/src/components/searchPanel.component.pug index d8077ab7..f886a186 100644 --- a/terminus-terminal/src/components/searchPanel.component.pug +++ b/terminus-terminal/src/components/searchPanel.component.pug @@ -26,7 +26,7 @@ button.btn.btn-link( .mr-2 button.btn.btn-link( - (click)='options.caseSensitive = !options.caseSensitive', + (click)='options.caseSensitive = !options.caseSensitive; saveSearchOptions()', [class.active]='options.caseSensitive', ngbTooltip='Case sensitivity', placement='bottom' @@ -34,14 +34,14 @@ button.btn.btn-link( i.fa.fa-fw.fa-font button.btn.btn-link( - (click)='options.regex = !options.regex', + (click)='options.regex = !options.regex; saveSearchOptions()', [class.active]='options.regex', ngbTooltip='Regular expression', placement='bottom' ) i.fa.fa-fw.fa-asterisk button.btn.btn-link( - (click)='options.wholeWord = !options.wholeWord', + (click)='options.wholeWord = !options.wholeWord; saveSearchOptions()', [class.active]='options.wholeWord', ngbTooltip='Whole word', placement='bottom' diff --git a/terminus-terminal/src/components/searchPanel.component.ts b/terminus-terminal/src/components/searchPanel.component.ts index a5bf3c08..d5661a44 100644 --- a/terminus-terminal/src/components/searchPanel.component.ts +++ b/terminus-terminal/src/components/searchPanel.component.ts @@ -14,7 +14,7 @@ export class SearchPanelComponent { notFound = false options: SearchOptions = { incremental: true, - regex: this.config.store.terminal.searchRegexAlwaysEnabled, + ...this.config.store.terminal.searchOptions } @Output() close = new EventEmitter() @@ -28,7 +28,7 @@ export class SearchPanelComponent { this.notFound = false this.findPrevious(true) } - + findNext (incremental = false): void { if (!this.query) { return @@ -48,4 +48,12 @@ export class SearchPanelComponent { this.toastr.error('Not found') } } + + saveSearchOptions (): void { + this.config.store.terminal.searchOptions.regex = this.options.regex; + this.config.store.terminal.searchOptions.caseSensitive = this.options.caseSensitive; + this.config.store.terminal.searchOptions.wholeWord = this.options.wholeWord; + + this.config.save(); + } } diff --git a/terminus-terminal/src/config.ts b/terminus-terminal/src/config.ts index c779af2e..2abdfbdb 100644 --- a/terminus-terminal/src/config.ts +++ b/terminus-terminal/src/config.ts @@ -66,6 +66,11 @@ export class TerminalConfigProvider extends ConfigProvider { warnOnMultilinePaste: true, showDefaultProfiles: true, searchRegexAlwaysEnabled: false, + searchOptions: { + regex: false, + wholeWord: false, + caseSensitive: false + } }, } From 2c59022b782cfffe12ebf2d598fd28f75c22b701 Mon Sep 17 00:00:00 2001 From: matishadow Date: Fri, 23 Oct 2020 07:53:43 +0200 Subject: [PATCH 05/19] Fix lint --- .../src/components/searchPanel.component.ts | 16 ++++++++-------- terminus-terminal/src/config.ts | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/terminus-terminal/src/components/searchPanel.component.ts b/terminus-terminal/src/components/searchPanel.component.ts index d5661a44..25bbdbb6 100644 --- a/terminus-terminal/src/components/searchPanel.component.ts +++ b/terminus-terminal/src/components/searchPanel.component.ts @@ -14,7 +14,7 @@ export class SearchPanelComponent { notFound = false options: SearchOptions = { incremental: true, - ...this.config.store.terminal.searchOptions + ...this.config.store.terminal.searchOptions, } @Output() close = new EventEmitter() @@ -28,7 +28,7 @@ export class SearchPanelComponent { this.notFound = false this.findPrevious(true) } - + findNext (incremental = false): void { if (!this.query) { return @@ -48,12 +48,12 @@ export class SearchPanelComponent { this.toastr.error('Not found') } } - + saveSearchOptions (): void { - this.config.store.terminal.searchOptions.regex = this.options.regex; - this.config.store.terminal.searchOptions.caseSensitive = this.options.caseSensitive; - this.config.store.terminal.searchOptions.wholeWord = this.options.wholeWord; - - this.config.save(); + this.config.store.terminal.searchOptions.regex = this.options.regex + this.config.store.terminal.searchOptions.caseSensitive = this.options.caseSensitive + this.config.store.terminal.searchOptions.wholeWord = this.options.wholeWord + + this.config.save() } } diff --git a/terminus-terminal/src/config.ts b/terminus-terminal/src/config.ts index 2abdfbdb..fc05958e 100644 --- a/terminus-terminal/src/config.ts +++ b/terminus-terminal/src/config.ts @@ -69,8 +69,8 @@ export class TerminalConfigProvider extends ConfigProvider { searchOptions: { regex: false, wholeWord: false, - caseSensitive: false - } + caseSensitive: false, + }, }, } From 5e115c63f1fad32a75d20042d8107f6d6d91b2ee Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 23 Oct 2020 07:03:52 +0000 Subject: [PATCH 06/19] docs: update README.md [skip ci] --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a92be4fc..94012030 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Dmitry Pronin

💻
Jonathan Beverley

💻
Zenghai Liang

💻 +
Mateusz Tracz

💻 From 0c15fc2657c9222c16c8bbcd6dc77e3a8c5e0d91 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 23 Oct 2020 07:03:53 +0000 Subject: [PATCH 07/19] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index e6596af8..6b8737a5 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -307,6 +307,15 @@ "contributions": [ "code" ] + }, + { + "login": "matishadow", + "name": "Mateusz Tracz", + "avatar_url": "https://avatars0.githubusercontent.com/u/9083085?v=4", + "profile": "https://about.me/matishadow", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, From 299ede2eb1da5b748f88015f654eccf6e9643492 Mon Sep 17 00:00:00 2001 From: pinpin Date: Mon, 16 Nov 2020 21:41:11 +0200 Subject: [PATCH 08/19] Add Hide Tab Index and Hide Tab Close Button --- .../src/components/baseTab.component.ts | 2 ++ .../src/components/tabHeader.component.pug | 4 ++-- .../src/components/tabHeader.component.ts | 13 ++++++++++++- terminus-ssh/package.json | 2 +- .../appearanceSettingsTab.component.pug | 18 ++++++++++++++++++ terminus-terminal/src/config.ts | 2 ++ 6 files changed, 37 insertions(+), 4 deletions(-) diff --git a/terminus-core/src/components/baseTab.component.ts b/terminus-core/src/components/baseTab.component.ts index fea8b950..355f8002 100644 --- a/terminus-core/src/components/baseTab.component.ts +++ b/terminus-core/src/components/baseTab.component.ts @@ -45,6 +45,8 @@ export abstract class BaseTabComponent { color: string|null = null hasFocus = false + showIndex = true + showCloseButton = true /** * Ping this if your recovery state has been changed and you want diff --git a/terminus-core/src/components/tabHeader.component.pug b/terminus-core/src/components/tabHeader.component.pug index b59dfb63..889c7ec9 100644 --- a/terminus-core/src/components/tabHeader.component.pug +++ b/terminus-core/src/components/tabHeader.component.pug @@ -1,7 +1,7 @@ .progressbar([style.width]='progress + "%"', *ngIf='progress != null') -.index( +.index(*ngIf='tab.showIndex==true', #handle, [style.background-color]='tab.color', ) {{index + 1}} .name([title]='tab.customTitle || tab.title') {{tab.customTitle || tab.title}} -button((click)='app.closeTab(tab, true)') × +button(*ngIf='tab.showCloseButton==true',(click)='app.closeTab(tab, true)') × diff --git a/terminus-core/src/components/tabHeader.component.ts b/terminus-core/src/components/tabHeader.component.ts index b617149d..9cccbf1b 100644 --- a/terminus-core/src/components/tabHeader.component.ts +++ b/terminus-core/src/components/tabHeader.component.ts @@ -9,6 +9,7 @@ import { HotkeysService } from '../services/hotkeys.service' import { ElectronService } from '../services/electron.service' import { AppService } from '../services/app.service' import { HostAppService, Platform } from '../services/hostApp.service' +import { ConfigService } from '../services/config.service' /** @hidden */ export interface SortableComponentProxy { @@ -35,8 +36,9 @@ export class TabHeaderComponent { private hostApp: HostAppService, private ngbModal: NgbModal, private hotkeys: HotkeysService, + private config: ConfigService, @Inject(SortableComponent) private parentDraggable: SortableComponentProxy, - @Optional() @Inject(TabContextMenuItemProvider) protected contextMenuProviders: TabContextMenuItemProvider[], + @Optional() @Inject(TabContextMenuItemProvider) protected contextMenuProviders: TabContextMenuItemProvider[], ) { this.hotkeys.matchedHotkey.subscribe((hotkey) => { if (this.app.activeTab === this.tab) { @@ -52,6 +54,15 @@ export class TabHeaderComponent { this.tab.progress$.subscribe(progress => { this.progress = progress }) + + if (this.config.store.terminal.disableTabIndex) { + this.tab.showIndex = false; + } + + if (this.config.store.terminal.disableCloseButton) { + this.tab.showCloseButton = false; + } + } ngAfterViewInit () { diff --git a/terminus-ssh/package.json b/terminus-ssh/package.json index 481b8097..39a6357f 100644 --- a/terminus-ssh/package.json +++ b/terminus-ssh/package.json @@ -10,7 +10,7 @@ "scripts": { "build": "webpack --progress --color", "watch": "webpack --progress --color --watch", - "postinstall": "xcopy /i node_modules\\ssh2\\util\\pagent.exe util\\" + "postinstall:win32": "xcopy /i node_modules\\ssh2\\util\\pagent.exe util\\" }, "files": [ "dist", diff --git a/terminus-terminal/src/components/appearanceSettingsTab.component.pug b/terminus-terminal/src/components/appearanceSettingsTab.component.pug index 90eb2c6e..1717dea3 100644 --- a/terminus-terminal/src/components/appearanceSettingsTab.component.pug +++ b/terminus-terminal/src/components/appearanceSettingsTab.component.pug @@ -109,6 +109,24 @@ h3.mb-3 Appearance (ngModelChange)='config.save()', ) +.form-line + .header + .title Disable Tab Index + + toggle( + [(ngModel)]='config.store.terminal.disableTabIndex', + (ngModelChange)='config.save()', + ) + +.form-line + .header + .title Disable Tab Close Button + + toggle( + [(ngModel)]='config.store.terminal.disableCloseButton', + (ngModelChange)='config.save()', + ) + .form-line .header .title Fallback font diff --git a/terminus-terminal/src/config.ts b/terminus-terminal/src/config.ts index fc05958e..5983266f 100644 --- a/terminus-terminal/src/config.ts +++ b/terminus-terminal/src/config.ts @@ -23,6 +23,8 @@ export class TerminalConfigProvider extends ConfigProvider { ligatures: false, cursor: 'block', cursorBlink: true, + disableTabIndex: false, + disableCloseButton: false, customShell: '', rightClick: 'menu', pasteOnMiddleClick: true, From 3931e8088e51d6d8c8d545e943706c2c1061f21a Mon Sep 17 00:00:00 2001 From: pinpin Date: Mon, 16 Nov 2020 21:44:20 +0200 Subject: [PATCH 09/19] revert version of node --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cd7a11d4..e8dbc628 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: node_js -node_js: 11 +node_js: 10 stages: - Build From 17cafbfa5237f7dd568f41836b328fa313fdb5f6 Mon Sep 17 00:00:00 2001 From: pinpin Date: Mon, 16 Nov 2020 22:19:44 +0200 Subject: [PATCH 10/19] add restart prompt --- .../src/components/appearanceSettingsTab.component.pug | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terminus-terminal/src/components/appearanceSettingsTab.component.pug b/terminus-terminal/src/components/appearanceSettingsTab.component.pug index 1717dea3..aeda0d5c 100644 --- a/terminus-terminal/src/components/appearanceSettingsTab.component.pug +++ b/terminus-terminal/src/components/appearanceSettingsTab.component.pug @@ -115,7 +115,7 @@ h3.mb-3 Appearance toggle( [(ngModel)]='config.store.terminal.disableTabIndex', - (ngModelChange)='config.save()', + (ngModelChange)='config.save(); config.requestRestart()', ) .form-line @@ -124,7 +124,7 @@ h3.mb-3 Appearance toggle( [(ngModel)]='config.store.terminal.disableCloseButton', - (ngModelChange)='config.save()', + (ngModelChange)='config.save(); config.requestRestart()', ) .form-line From 37cc37650e63668b9a7eb5529c6e49d327f39d72 Mon Sep 17 00:00:00 2001 From: pinpin Date: Tue, 17 Nov 2020 09:14:05 +0200 Subject: [PATCH 11/19] Fixes based on PR reviews --- terminus-core/src/components/baseTab.component.ts | 2 -- .../src/components/tabHeader.component.pug | 4 ++-- terminus-core/src/components/tabHeader.component.ts | 13 ++----------- .../components/appearanceSettingsTab.component.pug | 8 ++++---- 4 files changed, 8 insertions(+), 19 deletions(-) diff --git a/terminus-core/src/components/baseTab.component.ts b/terminus-core/src/components/baseTab.component.ts index 355f8002..fea8b950 100644 --- a/terminus-core/src/components/baseTab.component.ts +++ b/terminus-core/src/components/baseTab.component.ts @@ -45,8 +45,6 @@ export abstract class BaseTabComponent { color: string|null = null hasFocus = false - showIndex = true - showCloseButton = true /** * Ping this if your recovery state has been changed and you want diff --git a/terminus-core/src/components/tabHeader.component.pug b/terminus-core/src/components/tabHeader.component.pug index 889c7ec9..676a495a 100644 --- a/terminus-core/src/components/tabHeader.component.pug +++ b/terminus-core/src/components/tabHeader.component.pug @@ -1,7 +1,7 @@ .progressbar([style.width]='progress + "%"', *ngIf='progress != null') -.index(*ngIf='tab.showIndex==true', +.index(*ngIf='!config.store.terminal.disableTabIndex', #handle, [style.background-color]='tab.color', ) {{index + 1}} .name([title]='tab.customTitle || tab.title') {{tab.customTitle || tab.title}} -button(*ngIf='tab.showCloseButton==true',(click)='app.closeTab(tab, true)') × +button(*ngIf='!config.store.terminal.disableCloseButton',(click)='app.closeTab(tab, true)') × diff --git a/terminus-core/src/components/tabHeader.component.ts b/terminus-core/src/components/tabHeader.component.ts index 9cccbf1b..3df6a932 100644 --- a/terminus-core/src/components/tabHeader.component.ts +++ b/terminus-core/src/components/tabHeader.component.ts @@ -32,13 +32,13 @@ export class TabHeaderComponent { private constructor ( public app: AppService, + public config: ConfigService, private electron: ElectronService, private hostApp: HostAppService, private ngbModal: NgbModal, private hotkeys: HotkeysService, - private config: ConfigService, @Inject(SortableComponent) private parentDraggable: SortableComponentProxy, - @Optional() @Inject(TabContextMenuItemProvider) protected contextMenuProviders: TabContextMenuItemProvider[], + @Optional() @Inject(TabContextMenuItemProvider) protected contextMenuProviders: TabContextMenuItemProvider[], ) { this.hotkeys.matchedHotkey.subscribe((hotkey) => { if (this.app.activeTab === this.tab) { @@ -54,15 +54,6 @@ export class TabHeaderComponent { this.tab.progress$.subscribe(progress => { this.progress = progress }) - - if (this.config.store.terminal.disableTabIndex) { - this.tab.showIndex = false; - } - - if (this.config.store.terminal.disableCloseButton) { - this.tab.showCloseButton = false; - } - } ngAfterViewInit () { diff --git a/terminus-terminal/src/components/appearanceSettingsTab.component.pug b/terminus-terminal/src/components/appearanceSettingsTab.component.pug index aeda0d5c..d4b7c5a9 100644 --- a/terminus-terminal/src/components/appearanceSettingsTab.component.pug +++ b/terminus-terminal/src/components/appearanceSettingsTab.component.pug @@ -111,20 +111,20 @@ h3.mb-3 Appearance .form-line .header - .title Disable Tab Index + .title Disable tab index toggle( [(ngModel)]='config.store.terminal.disableTabIndex', - (ngModelChange)='config.save(); config.requestRestart()', + (ngModelChange)='config.save();', ) .form-line .header - .title Disable Tab Close Button + .title Disable tab close button toggle( [(ngModel)]='config.store.terminal.disableCloseButton', - (ngModelChange)='config.save(); config.requestRestart()', + (ngModelChange)='config.save();', ) .form-line From 225760a9a59341570473cbb2c3b862f9304d3da4 Mon Sep 17 00:00:00 2001 From: Harsh Gadgil Date: Thu, 3 Dec 2020 19:09:26 -0500 Subject: [PATCH 12/19] Update api.ts Fix typos --- terminus-ssh/src/api.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/terminus-ssh/src/api.ts b/terminus-ssh/src/api.ts index 34a424ba..4e9d662b 100644 --- a/terminus-ssh/src/api.ts +++ b/terminus-ssh/src/api.ts @@ -246,7 +246,7 @@ export class SSHSession extends BaseSession { fw.targetPort, (err, stream) => { if (err) { - this.emitServiceMessage(colors.bgRed.black(' X ') + ` Remote has rejected the forwaded connection via ${fw}: ${err}`) + this.emitServiceMessage(colors.bgRed.black(' X ') + ` Remote has rejected the forwarded connection via ${fw}: ${err}`) socket.destroy() return } @@ -263,7 +263,7 @@ export class SSHSession extends BaseSession { } ) }).then(() => { - this.emitServiceMessage(colors.bgGreen.black(' -> ') + ` Forwaded ${fw}`) + this.emitServiceMessage(colors.bgGreen.black(' -> ') + ` Forwarded ${fw}`) this.forwardedPorts.push(fw) }).catch(e => { this.emitServiceMessage(colors.bgRed.black(' X ') + ` Failed to forward port ${fw}: ${e}`) @@ -280,7 +280,7 @@ export class SSHSession extends BaseSession { resolve() }) }) - this.emitServiceMessage(colors.bgGreen.black(' <- ') + ` Forwaded ${fw}`) + this.emitServiceMessage(colors.bgGreen.black(' <- ') + ` Forwarded ${fw}`) this.forwardedPorts.push(fw) } } From dd3e7a0f89c0f7f07f1f90984a1f86d849c58d9f Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sun, 6 Dec 2020 15:39:49 +0100 Subject: [PATCH 13/19] fixed #2558 --- app/lib/window.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/lib/window.ts b/app/lib/window.ts index cc1d4fac..feed335b 100644 --- a/app/lib/window.ts +++ b/app/lib/window.ts @@ -211,9 +211,7 @@ export class Window { } handleSecondInstance (argv: string[], cwd: string): void { - if (!this.configStore.appearance?.dock) { - this.send('host:second-instance', parseArgs(argv, cwd), cwd) - } + this.send('host:second-instance', parseArgs(argv, cwd), cwd) } private setupWindowManagement () { From 86b503093cd1f05fc515b895c760dd03098e1f83 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sun, 6 Dec 2020 17:03:07 +0100 Subject: [PATCH 14/19] only send args to the most recent window --- app/lib/app.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/lib/app.ts b/app/lib/app.ts index a1c016c8..10e89b19 100644 --- a/app/lib/app.ts +++ b/app/lib/app.ts @@ -139,9 +139,7 @@ export class Application { handleSecondInstance (argv: string[], cwd: string): void { this.presentAllWindows() - for (let window of this.windows) { - window.handleSecondInstance(argv, cwd) - } + this.windows[this.windows.length - 1].handleSecondInstance(argv, cwd) } private setupMenu () { From 7977c1d644e64da0cd26e5ce3887590fe27a8880 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sun, 6 Dec 2020 17:27:45 +0100 Subject: [PATCH 15/19] cleanup --- terminus-core/src/components/tabHeader.component.pug | 4 ++-- terminus-ssh/package.json | 5 ++++- terminus-ssh/yarn.lock | 5 +++++ .../src/components/appearanceSettingsTab.component.pug | 8 ++++---- terminus-terminal/src/config.ts | 4 ++-- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/terminus-core/src/components/tabHeader.component.pug b/terminus-core/src/components/tabHeader.component.pug index 676a495a..76447550 100644 --- a/terminus-core/src/components/tabHeader.component.pug +++ b/terminus-core/src/components/tabHeader.component.pug @@ -1,7 +1,7 @@ .progressbar([style.width]='progress + "%"', *ngIf='progress != null') -.index(*ngIf='!config.store.terminal.disableTabIndex', +.index(*ngIf='!config.store.terminal.hideTabIndex', #handle, [style.background-color]='tab.color', ) {{index + 1}} .name([title]='tab.customTitle || tab.title') {{tab.customTitle || tab.title}} -button(*ngIf='!config.store.terminal.disableCloseButton',(click)='app.closeTab(tab, true)') × +button(*ngIf='!config.store.terminal.hideCloseButton',(click)='app.closeTab(tab, true)') × diff --git a/terminus-ssh/package.json b/terminus-ssh/package.json index 39a6357f..a1e7d0fe 100644 --- a/terminus-ssh/package.json +++ b/terminus-ssh/package.json @@ -10,7 +10,9 @@ "scripts": { "build": "webpack --progress --color", "watch": "webpack --progress --color --watch", - "postinstall:win32": "xcopy /i node_modules\\ssh2\\util\\pagent.exe util\\" + "postinstall": "run-script-os", + "postinstall:win32": "xcopy /i node_modules\\ssh2\\util\\pagent.exe util\\", + "postinstall:darwin:linux": "exit" }, "files": [ "dist", @@ -23,6 +25,7 @@ "@types/ssh2": "^0.5.35", "ansi-colors": "^4.1.1", "cli-spinner": "^0.2.10", + "run-script-os": "^1.1.3", "ssh2": "^0.8.2", "ssh2-streams": "Eugeny/ssh2-streams#75f6d3425d071ac73a18fd46e2f5e738bfe897c5", "sshpk": "^1.16.1", diff --git a/terminus-ssh/yarn.lock b/terminus-ssh/yarn.lock index 392a7188..c0387d7d 100644 --- a/terminus-ssh/yarn.lock +++ b/terminus-ssh/yarn.lock @@ -157,6 +157,11 @@ rimraf@~2.6.2: dependencies: glob "^7.1.3" +run-script-os@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/run-script-os/-/run-script-os-1.1.3.tgz#1069b418307f4fd36ff056b5eda309c273fca8b0" + integrity sha512-xPlzE6533nvWVea5z7e5J7+JAIepfpxTu/HLGxcjJYlemVukOCWJBaRCod/DWXJFRIWEFOgSGbjd2m1QWTJi5w== + safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" diff --git a/terminus-terminal/src/components/appearanceSettingsTab.component.pug b/terminus-terminal/src/components/appearanceSettingsTab.component.pug index d4b7c5a9..9cb61770 100644 --- a/terminus-terminal/src/components/appearanceSettingsTab.component.pug +++ b/terminus-terminal/src/components/appearanceSettingsTab.component.pug @@ -111,19 +111,19 @@ h3.mb-3 Appearance .form-line .header - .title Disable tab index + .title Hide tab index toggle( - [(ngModel)]='config.store.terminal.disableTabIndex', + [(ngModel)]='config.store.terminal.hideTabIndex', (ngModelChange)='config.save();', ) .form-line .header - .title Disable tab close button + .title Hide tab close button toggle( - [(ngModel)]='config.store.terminal.disableCloseButton', + [(ngModel)]='config.store.terminal.hideCloseButton', (ngModelChange)='config.save();', ) diff --git a/terminus-terminal/src/config.ts b/terminus-terminal/src/config.ts index 5983266f..ae7a500b 100644 --- a/terminus-terminal/src/config.ts +++ b/terminus-terminal/src/config.ts @@ -23,8 +23,8 @@ export class TerminalConfigProvider extends ConfigProvider { ligatures: false, cursor: 'block', cursorBlink: true, - disableTabIndex: false, - disableCloseButton: false, + hideTabIndex: false, + hideCloseButton: false, customShell: '', rightClick: 'menu', pasteOnMiddleClick: true, From 9a60b4d102b08679a551c4eadf66fdf3e519cfcb Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sun, 6 Dec 2020 16:28:08 +0000 Subject: [PATCH 16/19] docs: update README.md [skip ci] --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 94012030..868ad12c 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Jonathan Beverley

💻
Zenghai Liang

💻
Mateusz Tracz

💻 +
pinpin

💻 From c6188a49f573a1e4830c42e79e4c1cd95ad3082e Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sun, 6 Dec 2020 16:28:09 +0000 Subject: [PATCH 17/19] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 6b8737a5..6a3ac35c 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -316,6 +316,15 @@ "contributions": [ "code" ] + }, + { + "login": "pinpins", + "name": "pinpin", + "avatar_url": "https://avatars3.githubusercontent.com/u/36234677?v=4", + "profile": "https://zergpool.com", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, From e6fd31e0b00c22a6cc6aba400e2c5d019e185e26 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sun, 6 Dec 2020 17:43:00 +0100 Subject: [PATCH 18/19] don't try to load the private key if not selected - fixes #2968 --- terminus-ssh/src/services/ssh.service.ts | 39 +++++++++++++++--------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/terminus-ssh/src/services/ssh.service.ts b/terminus-ssh/src/services/ssh.service.ts index d65658d2..ee8098c3 100644 --- a/terminus-ssh/src/services/ssh.service.ts +++ b/terminus-ssh/src/services/ssh.service.ts @@ -22,6 +22,11 @@ try { var windowsProcessTreeNative = require('windows-process-tree/build/Release/windows_process_tree.node') // eslint-disable-line @typescript-eslint/no-var-requires, no-var } catch { } + +// eslint-disable-next-line @typescript-eslint/no-type-alias +export type SSHLogCallback = (message: string) => void + + @Injectable({ providedIn: 'root' }) export class SSHService { private logger: Logger @@ -46,33 +51,24 @@ export class SSHService { return session } - async connectSession (session: SSHSession, logCallback?: (s: any) => void): Promise { + async loadPrivateKeyForSession (session: SSHSession, logCallback?: SSHLogCallback): Promise { let privateKey: string|null = null let privateKeyPath = session.connection.privateKey - if (!logCallback) { - logCallback = () => null - } - - const log = (s: any) => { - logCallback!(s) - this.logger.info(s) - } - if (!privateKeyPath) { const userKeyPath = path.join(process.env.HOME as string, '.ssh', 'id_rsa') if (await fs.exists(userKeyPath)) { - log('Using user\'s default private key') + logCallback?.('Using user\'s default private key') privateKeyPath = userKeyPath } } if (privateKeyPath) { - log('Loading private key from ' + colors.bgWhite.blackBright(' ' + privateKeyPath + ' ')) + logCallback?.('Loading private key from ' + colors.bgWhite.blackBright(' ' + privateKeyPath + ' ')) try { privateKey = (await fs.readFile(privateKeyPath)).toString() } catch (error) { - log(colors.bgRed.black(' X ') + 'Could not read the private key file') + logCallback?.(colors.bgRed.black(' X ') + 'Could not read the private key file') this.toastr.error('Could not read the private key file') } @@ -83,7 +79,7 @@ export class SSHService { } catch (e) { if (e instanceof sshpk.KeyEncryptedError) { const modal = this.ngbModal.open(PromptModalComponent) - log(colors.bgYellow.yellow.black(' ! ') + ' Key requires passphrase') + logCallback?.(colors.bgYellow.yellow.black(' ! ') + ' Key requires passphrase') modal.componentInstance.prompt = 'Private key passphrase' modal.componentInstance.password = true let passphrase = '' @@ -131,6 +127,20 @@ export class SSHService { fs.unlink(temp.path) } } + return privateKey + } + + async connectSession (session: SSHSession, logCallback?: SSHLogCallback): Promise { + if (!logCallback) { + logCallback = () => null + } + + const log = (s: any) => { + logCallback!(s) + this.logger.info(s) + } + + let privateKey: string|null = null const ssh = new Client() session.ssh = ssh @@ -213,6 +223,7 @@ export class SSHService { const authMethodsLeft = ['none'] if (!session.connection.auth || session.connection.auth === 'publicKey') { + privateKey = await this.loadPrivateKeyForSession(session, log) if (!privateKey) { log('\r\nPrivate key auth selected, but no key is loaded\r\n') } else { From 17f52a257ebc688397b45a0480f1b88ad10ab35c Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sun, 6 Dec 2020 18:11:15 +0100 Subject: [PATCH 19/19] PS ctrl-left, ctrl-right and ctrl-del bindings (#507, #2739) --- .../src/api/baseTerminalTab.component.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/terminus-terminal/src/api/baseTerminalTab.component.ts b/terminus-terminal/src/api/baseTerminalTab.component.ts index d949146a..b622b020 100644 --- a/terminus-terminal/src/api/baseTerminalTab.component.ts +++ b/terminus-terminal/src/api/baseTerminalTab.component.ts @@ -156,16 +156,28 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit this.resetZoom() break case 'previous-word': - this.sendInput('\x1bb') + this.sendInput({ + [Platform.Windows]: '\x1b[1;5D', + [Platform.macOS]: '\x1bb', + [Platform.Linux]: '\x1bb', + }[this.hostApp.platform]) break case 'next-word': - this.sendInput('\x1bf') + this.sendInput({ + [Platform.Windows]: '\x1b[1;5C', + [Platform.macOS]: '\x1bf', + [Platform.Linux]: '\x1bf', + }[this.hostApp.platform]) break case 'delete-previous-word': this.sendInput('\x1b\x7f') break case 'delete-next-word': - this.sendInput('\x1bd') + this.sendInput({ + [Platform.Windows]: '\x1bd\x1b[3;5~', + [Platform.macOS]: '\x1bd', + [Platform.Linux]: '\x1bd', + }[this.hostApp.platform]) break case 'search': this.showSearchPanel = true