Add on-redraw hook command (#1479)
* Add `on-redraw` hook command * Add documentation
This commit is contained in:
1 parent
7c23c27c59
commit
b3cb2dc2b4
4 files changed
+25
No files matched your search
@@ -208,6 +208,7 @@ The following special shell commands are used to customize the behavior of lf wh
|
||||
pre-cd
|
||||
on-cd
|
||||
on-select
|
||||
on-redraw
|
||||
on-quit
|
||||
|
||||
The following commands/keybindings are provided by default:
|
||||
@@ -1110,6 +1111,10 @@ This shell command can be defined to be executed after changing a directory.
|
||||
|
||||
This shell command can be defined to be executed after the selection changes.
|
||||
|
||||
on-redraw
|
||||
|
||||
This shell command can be defined to be executed after the screen is redrawn or if the terminal is resized.
|
||||
|
||||
on-quit
|
||||
|
||||
This shell command can be defined to be executed before quit.
|
||||
|
||||
@@ -212,6 +212,7 @@ when defined:
|
||||
pre-cd
|
||||
on-cd
|
||||
on-select
|
||||
on-redraw
|
||||
on-quit
|
||||
|
||||
The following commands/keybindings are provided by default:
|
||||
@@ -1202,6 +1203,11 @@ This shell command can be defined to be executed after changing a directory.
|
||||
|
||||
This shell command can be defined to be executed after the selection changes.
|
||||
|
||||
on-redraw
|
||||
|
||||
This shell command can be defined to be executed after the screen is redrawn or
|
||||
if the terminal is resized.
|
||||
|
||||
on-quit
|
||||
|
||||
This shell command can be defined to be executed before quit.
|
||||
|
||||
@@ -1151,6 +1151,12 @@ func onChdir(app *app) {
|
||||
}
|
||||
}
|
||||
|
||||
func onRedraw(app *app) {
|
||||
if cmd, ok := gOpts.cmds["on-redraw"]; ok {
|
||||
cmd.eval(app, nil)
|
||||
}
|
||||
}
|
||||
|
||||
func onSelect(app *app) {
|
||||
if cmd, ok := gOpts.cmds["on-select"]; ok {
|
||||
cmd.eval(app, nil)
|
||||
@@ -1944,6 +1950,7 @@ func (e *callExpr) eval(app *app, args []string) {
|
||||
dir.boundPos(app.nav.height)
|
||||
}
|
||||
app.ui.loadFile(app, true)
|
||||
onRedraw(app)
|
||||
case "load":
|
||||
if !app.nav.init {
|
||||
return
|
||||
|
||||
@@ -231,6 +231,7 @@ The following special shell commands are used to customize the behavior of lf wh
|
||||
pre-cd
|
||||
on-cd
|
||||
on-select
|
||||
on-redraw
|
||||
on-quit
|
||||
.EE
|
||||
.PP
|
||||
@@ -1332,6 +1333,12 @@ This shell command can be defined to be executed after changing a directory.
|
||||
.PP
|
||||
This shell command can be defined to be executed after the selection changes.
|
||||
.PP
|
||||
.EX
|
||||
on-redraw
|
||||
.EE
|
||||
.PP
|
||||
This shell command can be defined to be executed after the screen is redrawn or if the terminal is resized.
|
||||
.PP
|
||||
.EX
|
||||
on-quit
|
||||
.EE
|
||||
|
||||
Reference in new issue
Block a user