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:
Thomas Aynaud 2018-06-18 15:01:40 +02:00
parent 281db7f5e3
commit 90b5fa5d1c

View file

@ -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)