Add on-init hook command (#1838)
This commit is contained in:
1 parent
0b51987044
commit
670343a23f
5 files changed
+27
-2
No files matched your search
@@ -600,6 +600,12 @@ func onFocusLost(app *app) {
|
||||
}
|
||||
}
|
||||
|
||||
func onInit(app *app) {
|
||||
if cmd, ok := gOpts.cmds["on-init"]; ok {
|
||||
cmd.eval(app, nil)
|
||||
}
|
||||
}
|
||||
|
||||
func onRedraw(app *app) {
|
||||
if cmd, ok := gOpts.cmds["on-redraw"]; ok {
|
||||
cmd.eval(app, nil)
|
||||
@@ -1801,6 +1807,8 @@ func (e *callExpr) eval(app *app, args []string) {
|
||||
onFocusGained(app)
|
||||
case "on-focus-lost":
|
||||
onFocusLost(app)
|
||||
case "on-init":
|
||||
onInit(app)
|
||||
case "cmd-insert":
|
||||
if len(e.args) == 0 {
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user