[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 { "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.config.General.ContextSpecificSearch = !a.config.General.ContextSpecificSearch
a.PrintBody(g) a.PrintBody(g)
return nil 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 { func scrollView(v *gocui.View, dy int) error {

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

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

Loading…
Cancel
Save