Skip to content

Commit

Permalink
[enh] add clearHistory command
Browse files Browse the repository at this point in the history
  • Loading branch information
asciimoo committed Apr 14, 2017
1 parent 974f00b commit bbf21cb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions sample-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CtrlD = "deleteLine"
CtrlW = "deleteWord"
CtrlE = "saveRequest"
CtrlT = "toggleContextSpecificSearch"
CtrlX = "clearHistory"
Tab = "nextView"
CtrlJ = "nextView"
CtrlK = "prevView"
Expand Down

0 comments on commit bbf21cb

Please sign in to comment.