1
1
mirror of https://github.com/Eugeny/tabby.git synced 2025-01-06 18:59:03 +03:00

search direction buttons (fixes #2251)

This commit is contained in:
Eugene Pankov 2020-03-25 21:51:00 +01:00
parent 6065a95132
commit ffa4350420
3 changed files with 62 additions and 44 deletions

View File

@ -1,36 +1,51 @@
.input-group.w-100
input.search-input.form-control(
type='search',
[(ngModel)]='query',
(ngModelChange)='onQueryChange()',
[class.text-danger]='notFound',
(click)='$event.stopPropagation()',
(keyup.enter)='findNext()',
(keyup.esc)='close.emit()',
placeholder='Search...'
)
.input-group-append
.input-group-text
a(
(click)='options.caseSensitive = !options.caseSensitive',
[class.text-info]='options.caseSensitive',
ngbTooltip='Case sensitivity',
placement='bottom'
)
i.fa.fa-fw.fa-font
a(
(click)='options.regex = !options.regex',
[class.text-info]='options.regex',
ngbTooltip='Regular expression',
placement='bottom'
)
i.fa.fa-fw.fa-asterisk
a(
(click)='options.wholeWord = !options.wholeWord',
[class.text-info]='options.wholeWord',
ngbTooltip='Whole word',
placement='bottom'
)
i.fa.fa-fw.fa-text-width
input.search-input.form-control(
type='search',
[(ngModel)]='query',
(ngModelChange)='onQueryChange()',
[class.text-danger]='notFound',
(click)='$event.stopPropagation()',
(keyup.enter)='findPrevious()',
(keyup.esc)='close.emit()',
placeholder='Search...'
)
button.btn.btn-link(
(click)='findPrevious()',
ngbTooltip='Next',
placement='bottom'
)
i.fa.fa-fw.fa-arrow-up
button.btn.btn-link(
(click)='findNext()',
ngbTooltip='Next',
placement='bottom'
)
i.fa.fa-fw.fa-arrow-down
.mr-2
button.btn.btn-link(
(click)='options.caseSensitive = !options.caseSensitive',
[class.active]='options.caseSensitive',
ngbTooltip='Case sensitivity',
placement='bottom'
)
i.fa.fa-fw.fa-font
button.btn.btn-link(
(click)='options.regex = !options.regex',
[class.active]='options.regex',
ngbTooltip='Regular expression',
placement='bottom'
)
i.fa.fa-fw.fa-asterisk
button.btn.btn-link(
(click)='options.wholeWord = !options.wholeWord',
[class.active]='options.wholeWord',
ngbTooltip='Whole word',
placement='bottom'
)
i.fa.fa-fw.fa-text-width
button.close.text-light.pl-3.pr-2((click)='close.emit()') ×

View File

@ -5,16 +5,13 @@
z-index: 5;
padding: 10px;
border-radius: 0 0 3px 3px;
background: rgba(0, 0, 0, .75);
background: rgba(0, 0, 0, .95);
border: 1px solid rgba(0, 0, 0, .5);
border-top: 0;
display: flex;
a {
padding-left: 10px;
&:first-child {
padding-left: 0;
}
button {
padding: 0 6px;
flex-shrink: 0;
}
}

View File

@ -23,18 +23,24 @@ export class SearchPanelComponent {
onQueryChange (): void {
this.notFound = false
this.findNext(true)
this.findPrevious(true)
}
findNext (incremental = false): void {
if (!this.query) {
return
}
if (!this.frontend.findNext(this.query, { ...this.options, incremental: incremental || undefined })) {
this.notFound = true
this.toastr.error('Not found')
}
}
findPrevious (): void {
if (!this.frontend.findPrevious(this.query, this.options)) {
findPrevious (incremental = false): void {
if (!this.query) {
return
}
if (!this.frontend.findPrevious(this.query, { ...this.options, incremental: incremental || undefined })) {
this.notFound = true
this.toastr.error('Not found')
}