From 444d92d393eefe658bb8bcfe6b918aff65ec4033 Mon Sep 17 00:00:00 2001 From: matishadow Date: Thu, 8 Oct 2020 19:30:57 +0200 Subject: [PATCH 1/5] 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 2/5] 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 3/5] 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 4/5] 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 5/5] 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, + }, }, }