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

Re: [PATCH] Fix 'unset ZLE_RPROMPT_INDENT' not restoring the default behaviour.



Daniel Shahaf wrote on Sun, Mar 05, 2017 at 22:25:33 +0000:
> +/* Implements gsu_integer.unsetfn for ZLE_RPROMPT_INDENT; see stdunsetfn() */
> +
> +static void
> +rprompt_indent_unsetfn(Param pm, UNUSED(int exp))
> +{
> +    rprompt_indent = 1; /* Keep this in sync with init_term() */
> +}

That's wrong: unlike stdunsetfn(), it doesn't add the PM_UNSET bitflag,
so ${+ZLE_RPROMPT_INDENT} remains 1 after unsetting.

Fix:

diff --git a/Src/params.c b/Src/params.c
index f01bbfa..798e92c 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -131,7 +131,7 @@ mod_export int termflags;
 /* Forward declaration */
 
 static void
-rprompt_indent_unsetfn(Param pm, UNUSED(int exp));
+rprompt_indent_unsetfn(Param pm, int exp);
 
 /* Standard methods for get/set/unset pointers in parameters */
 
@@ -3745,8 +3745,9 @@ zlevarsetfn(Param pm, zlong x)
 /* Implements gsu_integer.unsetfn for ZLE_RPROMPT_INDENT; see stdunsetfn() */
 
 static void
-rprompt_indent_unsetfn(Param pm, UNUSED(int exp))
+rprompt_indent_unsetfn(Param pm, int exp)
 {
+    stdunsetfn(pm, exp);
     rprompt_indent = 1; /* Keep this in sync with init_term() */
 }
 



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