mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-16 09:29:59 +00:00
search direction buttons (fixes #2251)
This commit is contained in:
parent
6065a95132
commit
ffa4350420
@ -1,36 +1,51 @@
|
|||||||
.input-group.w-100
|
input.search-input.form-control(
|
||||||
input.search-input.form-control(
|
type='search',
|
||||||
type='search',
|
[(ngModel)]='query',
|
||||||
[(ngModel)]='query',
|
(ngModelChange)='onQueryChange()',
|
||||||
(ngModelChange)='onQueryChange()',
|
[class.text-danger]='notFound',
|
||||||
[class.text-danger]='notFound',
|
(click)='$event.stopPropagation()',
|
||||||
(click)='$event.stopPropagation()',
|
(keyup.enter)='findPrevious()',
|
||||||
(keyup.enter)='findNext()',
|
(keyup.esc)='close.emit()',
|
||||||
(keyup.esc)='close.emit()',
|
placeholder='Search...'
|
||||||
placeholder='Search...'
|
)
|
||||||
)
|
|
||||||
.input-group-append
|
button.btn.btn-link(
|
||||||
.input-group-text
|
(click)='findPrevious()',
|
||||||
a(
|
ngbTooltip='Next',
|
||||||
(click)='options.caseSensitive = !options.caseSensitive',
|
placement='bottom'
|
||||||
[class.text-info]='options.caseSensitive',
|
)
|
||||||
ngbTooltip='Case sensitivity',
|
i.fa.fa-fw.fa-arrow-up
|
||||||
placement='bottom'
|
|
||||||
)
|
button.btn.btn-link(
|
||||||
i.fa.fa-fw.fa-font
|
(click)='findNext()',
|
||||||
a(
|
ngbTooltip='Next',
|
||||||
(click)='options.regex = !options.regex',
|
placement='bottom'
|
||||||
[class.text-info]='options.regex',
|
)
|
||||||
ngbTooltip='Regular expression',
|
i.fa.fa-fw.fa-arrow-down
|
||||||
placement='bottom'
|
|
||||||
)
|
.mr-2
|
||||||
i.fa.fa-fw.fa-asterisk
|
|
||||||
a(
|
button.btn.btn-link(
|
||||||
(click)='options.wholeWord = !options.wholeWord',
|
(click)='options.caseSensitive = !options.caseSensitive',
|
||||||
[class.text-info]='options.wholeWord',
|
[class.active]='options.caseSensitive',
|
||||||
ngbTooltip='Whole word',
|
ngbTooltip='Case sensitivity',
|
||||||
placement='bottom'
|
placement='bottom'
|
||||||
)
|
)
|
||||||
i.fa.fa-fw.fa-text-width
|
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()') ×
|
button.close.text-light.pl-3.pr-2((click)='close.emit()') ×
|
||||||
|
@ -5,16 +5,13 @@
|
|||||||
z-index: 5;
|
z-index: 5;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border-radius: 0 0 3px 3px;
|
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: 1px solid rgba(0, 0, 0, .5);
|
||||||
border-top: 0;
|
border-top: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
a {
|
button {
|
||||||
padding-left: 10px;
|
padding: 0 6px;
|
||||||
|
flex-shrink: 0;
|
||||||
&:first-child {
|
|
||||||
padding-left: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,18 +23,24 @@ export class SearchPanelComponent {
|
|||||||
|
|
||||||
onQueryChange (): void {
|
onQueryChange (): void {
|
||||||
this.notFound = false
|
this.notFound = false
|
||||||
this.findNext(true)
|
this.findPrevious(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
findNext (incremental = false): void {
|
findNext (incremental = false): void {
|
||||||
|
if (!this.query) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (!this.frontend.findNext(this.query, { ...this.options, incremental: incremental || undefined })) {
|
if (!this.frontend.findNext(this.query, { ...this.options, incremental: incremental || undefined })) {
|
||||||
this.notFound = true
|
this.notFound = true
|
||||||
this.toastr.error('Not found')
|
this.toastr.error('Not found')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
findPrevious (): void {
|
findPrevious (incremental = false): void {
|
||||||
if (!this.frontend.findPrevious(this.query, this.options)) {
|
if (!this.query) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!this.frontend.findPrevious(this.query, { ...this.options, incremental: incremental || undefined })) {
|
||||||
this.notFound = true
|
this.notFound = true
|
||||||
this.toastr.error('Not found')
|
this.toastr.error('Not found')
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user