skip searches from command history

This commit is contained in:
Gokcehan 2018-05-20 20:38:18 +03:00
parent a85e0da9b0
commit 9400f07e45

16
eval.go
View File

@ -489,24 +489,30 @@ func (e *callExpr) eval(app *app, args []string) {
if p.err != nil { if p.err != nil {
app.ui.printf("%s", p.err) app.ui.printf("%s", p.err)
} }
app.cmdHistory = append(app.cmdHistory, cmdItem{app.ui.cmdPrefix, s})
app.ui.cmdPrefix = ""
case "$": case "$":
log.Printf("shell: %s", s) log.Printf("shell: %s", s)
app.runShell(s, nil, app.ui.cmdPrefix) app.runShell(s, nil, app.ui.cmdPrefix)
app.cmdHistory = append(app.cmdHistory, cmdItem{app.ui.cmdPrefix, s})
app.ui.cmdPrefix = ""
case "%": case "%":
log.Printf("shell-pipe: %s", s) log.Printf("shell-pipe: %s", s)
app.runShell(s, nil, app.ui.cmdPrefix) app.runShell(s, nil, app.ui.cmdPrefix)
app.cmdHistory = append(app.cmdHistory, cmdItem{"%", s}) app.cmdHistory = append(app.cmdHistory, cmdItem{app.ui.cmdPrefix, s})
return
case ">": case ">":
io.WriteString(app.cmdIn, s+"\n") io.WriteString(app.cmdIn, s+"\n")
app.cmdOutBuf = nil app.cmdOutBuf = nil
return
case "!": case "!":
log.Printf("shell-wait: %s", s) log.Printf("shell-wait: %s", s)
app.runShell(s, nil, app.ui.cmdPrefix) app.runShell(s, nil, app.ui.cmdPrefix)
app.cmdHistory = append(app.cmdHistory, cmdItem{app.ui.cmdPrefix, s})
app.ui.cmdPrefix = ""
case "&": case "&":
log.Printf("shell-async: %s", s) log.Printf("shell-async: %s", s)
app.runShell(s, nil, app.ui.cmdPrefix) app.runShell(s, nil, app.ui.cmdPrefix)
app.cmdHistory = append(app.cmdHistory, cmdItem{app.ui.cmdPrefix, s})
app.ui.cmdPrefix = ""
case "/": case "/":
log.Printf("search: %s", s) log.Printf("search: %s", s)
app.nav.search = s app.nav.search = s
@ -516,6 +522,7 @@ func (e *callExpr) eval(app *app, args []string) {
app.ui.loadFile(app.nav) app.ui.loadFile(app.nav)
app.ui.loadFileInfo(app.nav) app.ui.loadFileInfo(app.nav)
} }
app.ui.cmdPrefix = ""
case "?": case "?":
log.Printf("search-back: %s", s) log.Printf("search-back: %s", s)
app.nav.search = s app.nav.search = s
@ -525,11 +532,10 @@ func (e *callExpr) eval(app *app, args []string) {
app.ui.loadFile(app.nav) app.ui.loadFile(app.nav)
app.ui.loadFileInfo(app.nav) app.ui.loadFileInfo(app.nav)
} }
app.ui.cmdPrefix = ""
default: default:
log.Printf("entering unknown execution prefix: %q", app.ui.cmdPrefix) log.Printf("entering unknown execution prefix: %q", app.ui.cmdPrefix)
} }
app.cmdHistory = append(app.cmdHistory, cmdItem{app.ui.cmdPrefix, s})
app.ui.cmdPrefix = ""
case "cmd-history-next": case "cmd-history-next":
if app.ui.cmdPrefix == "" { if app.ui.cmdPrefix == "" {
return return