Make search toggleable

- `--phony` renamed to `--disabled` for consistency
    - `--no-phony` is now `--enabled`
- Added `enable-search`, `disable-search`, and `toggle-search` actions
  for `--bind`
- Added `--color` options: `query` and `disabled`

Close #2303
This commit is contained in:
Junegunn Choi
2021-01-03 00:00:40 +09:00
parent fd8858f8c9
commit d779ff7e6d
10 changed files with 132 additions and 49 deletions

View File

@@ -237,14 +237,16 @@ func Run(opts *Options, version string, revision string) {
go reader.restart(command)
}
eventBox.Watch(EvtReadNew)
query := []rune{}
for {
delay := true
ticks++
input := func() []rune {
if opts.Phony {
return []rune{}
paused, input := terminal.Input()
if !paused {
query = input
}
return []rune(terminal.Input())
return query
}
eventBox.Wait(func(events *util.Events) {
if _, fin := (*events)[EvtReadFin]; fin {