Make search options be remembered

This commit is contained in:
matishadow 2020-10-22 23:35:23 +02:00
parent afd6ce4346
commit 358d9f30d2
3 changed files with 18 additions and 5 deletions

View File

@ -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'

View File

@ -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();
}
}

View File

@ -66,6 +66,11 @@ export class TerminalConfigProvider extends ConfigProvider {
warnOnMultilinePaste: true,
showDefaultProfiles: true,
searchRegexAlwaysEnabled: false,
searchOptions: {
regex: false,
wholeWord: false,
caseSensitive: false
}
},
}