From 6616c9c119f84c15cd05e0c55146e7d2a78036a7 Mon Sep 17 00:00:00 2001 From: Joe Lim <50560759+joelim-work@users.noreply.github.com> Date: Mon, 28 Apr 2025 13:36:59 +1000 Subject: [PATCH] Restrict mode prefixes for cmd-history (#1971) --- eval.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eval.go b/eval.go index ff2c2954..b888d6a5 100644 --- a/eval.go +++ b/eval.go @@ -2009,7 +2009,7 @@ func (e *callExpr) eval(app *app, args []string) { log.Printf("entering unknown execution prefix: %q", app.ui.cmdPrefix) } case "cmd-history-next": - if app.ui.cmdPrefix == "" || app.ui.cmdPrefix == ">" { + if !slices.Contains([]string{":", "$", "!", "%", "&"}, app.ui.cmdPrefix) { return } if app.cmdHistoryInd > 0 { @@ -2027,7 +2027,7 @@ func (e *callExpr) eval(app *app, args []string) { app.ui.cmdPrefix = cmd.prefix app.ui.cmdAccLeft = []rune(cmd.value) case "cmd-history-prev": - if app.ui.cmdPrefix == ">" { + if !slices.Contains([]string{":", "$", "!", "%", "&", ""}, app.ui.cmdPrefix) { return } if app.cmdHistoryInd == len(app.cmdHistory) {