add shell prefixes to history

This commit is contained in:
Gokcehan 2019-02-08 19:19:28 +03:00
parent dd6a85f480
commit ca95bcf1d8

10
eval.go
View File

@ -873,7 +873,7 @@ func (e *callExpr) eval(app *app, args []string) {
case ":": case ":":
log.Printf("command: %s", s) log.Printf("command: %s", s)
app.ui.cmdPrefix = "" app.ui.cmdPrefix = ""
app.cmdHistory = append(app.cmdHistory, cmdItem{app.ui.cmdPrefix, s}) app.cmdHistory = append(app.cmdHistory, cmdItem{":", s})
p := newParser(strings.NewReader(s)) p := newParser(strings.NewReader(s))
for p.parse() { for p.parse() {
p.expr.eval(app, nil) p.expr.eval(app, nil)
@ -884,11 +884,11 @@ func (e *callExpr) eval(app *app, args []string) {
case "$": case "$":
log.Printf("shell: %s", s) log.Printf("shell: %s", s)
app.ui.cmdPrefix = "" app.ui.cmdPrefix = ""
app.cmdHistory = append(app.cmdHistory, cmdItem{app.ui.cmdPrefix, s}) app.cmdHistory = append(app.cmdHistory, cmdItem{"$", s})
app.runShell(s, nil, "$") app.runShell(s, nil, "$")
case "%": case "%":
log.Printf("shell-pipe: %s", s) log.Printf("shell-pipe: %s", s)
app.cmdHistory = append(app.cmdHistory, cmdItem{app.ui.cmdPrefix, s}) app.cmdHistory = append(app.cmdHistory, cmdItem{"%", s})
app.runShell(s, nil, "%") app.runShell(s, nil, "%")
case ">": case ">":
io.WriteString(app.cmdIn, s+"\n") io.WriteString(app.cmdIn, s+"\n")
@ -896,12 +896,12 @@ func (e *callExpr) eval(app *app, args []string) {
case "!": case "!":
log.Printf("shell-wait: %s", s) log.Printf("shell-wait: %s", s)
app.ui.cmdPrefix = "" app.ui.cmdPrefix = ""
app.cmdHistory = append(app.cmdHistory, cmdItem{app.ui.cmdPrefix, s}) app.cmdHistory = append(app.cmdHistory, cmdItem{"!", s})
app.runShell(s, nil, "!") app.runShell(s, nil, "!")
case "&": case "&":
log.Printf("shell-async: %s", s) log.Printf("shell-async: %s", s)
app.ui.cmdPrefix = "" app.ui.cmdPrefix = ""
app.cmdHistory = append(app.cmdHistory, cmdItem{app.ui.cmdPrefix, s}) app.cmdHistory = append(app.cmdHistory, cmdItem{"&", s})
app.runShell(s, nil, "&") app.runShell(s, nil, "&")
case "/": case "/":
if gOpts.incsearch { if gOpts.incsearch {