Fix implementation of silent commands (#2245)

* Fix implementation of silent commands

* Update `CHANGELOG.md`
This commit is contained in:
Joe Lim authored and GitHub committed 2025-11-01 18:34:09 +11:00
1 parent 95711c39bf
commit 5cdb6edd93
2 files changed
+18 -23

No files matched your search

+1
View File
@@ -38,6 +38,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
- A bug where setting `drawbox` could lead to scrolling outside the view is now fixed (#2210) (#2218).
- The preview cache is now not cleared when setting `ratios` to its current value (#2218).
- Filtering is fixed when using special characters in the search pattern if the `filtermethod` is `text` (#2231).
- Custom commands that output messages (e.g. `cmd greet echo 'hello world'`) now display properly (#2245).
## [r38](https://github.com/gokcehan/lf/releases/tag/r38)
+17 -23
View File
@@ -979,6 +979,23 @@ func exitCompMenu(app *app) {
func (e *callExpr) eval(app *app, _ []string) {
os.Setenv("lf_count", strconv.Itoa(e.count))
silentCmds := []string{
"addcustominfo",
"draw",
"load",
"push",
"redraw",
"source",
"sync",
"tty-write",
"on-focus-gained",
"on-focus-lost",
"on-init",
}
if !slices.Contains(silentCmds, e.name) && app.ui.cmdPrefix != ">" {
app.ui.echo("")
}
switch e.name {
case "quit":
app.quitChan <- struct{}{}
@@ -2270,29 +2287,6 @@ func (e *callExpr) eval(app *app, _ []string) {
}
cmd.eval(app, e.args)
}
// commands that run silently or write messages shouldn't clear existing messages
keepMsgCmds := []string{
"addcustominfo",
"draw",
"echo",
"echoerr",
"echomsg",
"load",
"push",
"redraw",
"source",
"sync",
"tty-write",
"cmd-enter",
"cmd-interrupt",
"on-focus-gained",
"on-focus-lost",
"on-init",
}
if !slices.Contains(keepMsgCmds, e.name) && app.ui.cmdPrefix != ">" {
app.ui.echo("")
}
}
func (e *execExpr) eval(app *app, args []string) {