Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: add-zle-hook-widget and multiple hooks



Daniel Shahaf wrote on Thu, 18 Jun 2020 11:42 +0000:
> Daniel Shahaf wrote on Wed, 10 Jun 2020 13:34 +0000:
> > Over here the jury's still out.  
> 
> In the absence of further feedback I've gone ahead completed the C patch
> using the originally posted syntax.  Any comments, reservations, etc.,
> speak up.

I missed some boilerplate in the argument parsing in C; interdiff:

diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c
index 63bd45c8d..cd3f2c356 100644
--- a/Src/Zle/zle_thingy.c
+++ b/Src/Zle/zle_thingy.c
@@ -737,12 +737,14 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
 	    switch (**args) {
 	    case 'f':
 		flag = args[0][1] ? args[0]+1 : args[1];
-		if (strcmp(flag, "nolast")) {
+		if (flag == NULL || strcmp(flag, "nolast")) {
 		    zwarnnam(name, "%s", "'nolast' expected after -f");
 		    if (remetafy)
 			metafy_line();
 		    return 1;
 		}
+		if (!args[0][1])
+		    *++args = skip_this_arg;
 		/* If you add magic strings here, be consistent with bin_zle_flags() */
 		setlbindk = 1;
 		break;

Cheers,

Daniel



Messages sorted by: Reverse Date, Date, Thread, Author