mirror of
https://github.com/peco/peco.git
synced 2026-09-10 07:16:29 -04:00
Add doToggleViewArround
Reset the query but do not move. This allows to select a line using peco filters and view around, for instance for a log analysis
This commit is contained in:
parent
281db7f5e3
commit
90b5fa5d1c
21
action.go
21
action.go
|
|
@ -127,6 +127,8 @@ func init() {
|
|||
ActionFunc(doRefreshScreen).Register("RefreshScreen", termbox.KeyCtrlL)
|
||||
ActionFunc(doToggleSingleKeyJump).Register("ToggleSingleKeyJump")
|
||||
|
||||
ActionFunc(doToggleViewArround).Register("ViewArround", termbox.KeyCtrlV)
|
||||
|
||||
ActionFunc(doKonamiCommand).RegisterKeySequence(
|
||||
"KonamiCommand",
|
||||
keyseq.KeyList{
|
||||
|
|
@ -771,6 +773,25 @@ func doToggleSingleKeyJump(ctx context.Context, state *Peco, e termbox.Event) {
|
|||
state.ToggleSingleKeyJumpMode()
|
||||
}
|
||||
|
||||
func doToggleViewArround(ctx context.Context, state *Peco, e termbox.Event) {
|
||||
if pdebug.Enabled {
|
||||
g := pdebug.Marker("doToggleViewArround")
|
||||
defer g.End()
|
||||
}
|
||||
q := state.Query()
|
||||
|
||||
if q.Len() > 0 {
|
||||
l, err := state.CurrentLineBuffer().LineAt(state.Location().LineNumber())
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
currentLine := l.ID()
|
||||
|
||||
doDeleteAll(ctx, state, e)
|
||||
state.Hub().SendPaging(JumpToLineRequest(currentLine))
|
||||
}
|
||||
}
|
||||
|
||||
func doSingleKeyJump(ctx context.Context, state *Peco, e termbox.Event) {
|
||||
if pdebug.Enabled {
|
||||
g := pdebug.Marker("doSingleKeyJump %c", e.Ch)
|
||||
|
|
|
|||
Loading…
Reference in a new issue