[enh] add clearHistory command

pull/94/head
Adam Tauber 7 years ago
parent 974f00be4e
commit bbf21cb5f7

@ -121,12 +121,20 @@ var COMMANDS map[string]func(string, *App) CommandFunc = map[string]func(string,
}
},
"toggleContextSpecificSearch": func(_ string, a *App) CommandFunc {
return func(g *gocui.Gui, v *gocui.View) error {
return func(g *gocui.Gui, _ *gocui.View) error {
a.config.General.ContextSpecificSearch = !a.config.General.ContextSpecificSearch
a.PrintBody(g)
return nil
}
},
"clearHistory": func(_ string, a *App) CommandFunc {
return func(g *gocui.Gui, _ *gocui.View) error {
a.history = make([]*Request, 0, 31)
a.historyIndex = 0
a.Layout(g)
return nil
}
},
}
func scrollView(v *gocui.View, dy int) error {

@ -60,6 +60,7 @@ var DefaultKeys = map[string]map[string]string{
"CtrlW": "deleteWord",
"CtrlO": "openEditor",
"CtrlT": "toggleContextSpecificSearch",
"CtrlX": "clearHistory",
"Tab": "nextView",
"CtrlJ": "nextView",
"CtrlK": "prevView",

@ -17,6 +17,7 @@ CtrlD = "deleteLine"
CtrlW = "deleteWord"
CtrlE = "saveRequest"
CtrlT = "toggleContextSpecificSearch"
CtrlX = "clearHistory"
Tab = "nextView"
CtrlJ = "nextView"
CtrlK = "prevView"

Loading…
Cancel
Save