diff options
Diffstat (limited to 'Src/Zle/zle_utils.c')
-rw-r--r-- | Src/Zle/zle_utils.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c index cc84eb8bb..291bdd3cb 100644 --- a/Src/Zle/zle_utils.c +++ b/Src/Zle/zle_utils.c @@ -1237,3 +1237,35 @@ viundochange(char **args) } else return undo(args); } + +/* + * Call a ZLE hook: a user-defined widget called at a specific point + * within the line editor. + * + * A single argument arg is passed to the function (in addition to the + * function name). It may be NULL. + */ + +/**/ +void +zlecallhook(char *name, char *arg) +{ + Thingy thingy = rthingy_nocreate(name); + int saverrflag, savretflag; + char *args[3]; + + if (!thingy) + return; + + saverrflag = errflag; + savretflag = retflag; + + args[0] = thingy->nam; + args[1] = arg; + args[2] = NULL; + execzlefunc(thingy, args, 1); + unrefthingy(thingy); + + errflag = saverrflag; + retflag = savretflag; +} |