make ctrl-f select the search query

This commit is contained in:
Eugene Pankov
2022-10-21 20:50:23 +02:00
parent 0e529ea5a1
commit aa439ccbb0
2 changed files with 28 additions and 15 deletions

View File

@@ -191,6 +191,20 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
this.logger = this.log.create('baseTerminalTab')
this.setTitle(this.translate.instant('Terminal'))
this.subscribeUntilDestroyed(this.hotkeys.unfilteredHotkey$, async hotkey => {
if (!this.hasFocus) {
return
}
if (hotkey === 'search') {
this.showSearchPanel = true
setImmediate(() => {
const input = this.element.nativeElement.querySelector('.search-input')
input?.focus()
input?.select()
})
}
})
this.subscribeUntilDestroyed(this.hotkeys.hotkey$, async hotkey => {
if (!this.hasFocus) {
return
@@ -265,14 +279,6 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
}[this.hostApp.platform])
})
break
case 'search':
this.showSearchPanel = true
setImmediate(() => {
const input = this.element.nativeElement.querySelector('.search-input')
input?.focus()
input?.select()
})
break
case 'pane-focus-all':
this.focusAllPanes()
break