summaryrefslogtreecommitdiff
path: root/Src/Zle/zle_params.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle/zle_params.c')
-rw-r--r--Src/Zle/zle_params.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c
index e2bbdd20b..ef8a98139 100644
--- a/Src/Zle/zle_params.c
+++ b/Src/Zle/zle_params.c
@@ -85,6 +85,10 @@ static struct zleparam {
unset_cutbuffer, NULL },
{ "killring", PM_ARRAY, FN(set_killring), FN(get_killring),
unset_killring, NULL },
+ { "PREDISPLAY", PM_SCALAR, FN(set_predisplay), FN(get_predisplay),
+ zleunsetfn, NULL },
+ { "POSTDISPLAY", PM_SCALAR, FN(set_postdisplay), FN(get_postdisplay),
+ zleunsetfn, NULL },
{ NULL, 0, NULL, NULL, NULL, NULL }
};
@@ -462,3 +466,53 @@ unset_killring(Param pm, int exp)
stdunsetfn(pm, exp);
}
}
+
+static void
+set_prepost(unsigned char **textvar, int *lenvar, char *x)
+{
+ if (*lenvar) {
+ zfree(*textvar, *lenvar);
+ *textvar = NULL;
+ *lenvar = 0;
+ }
+ if (x) {
+ unmetafy(x, lenvar);
+ *textvar = (unsigned char *)zalloc(*lenvar);
+ memcpy((char *)*textvar, x, *lenvar);
+ free(x);
+ }
+}
+
+static char *
+get_prepost(unsigned char *text, int len)
+{
+ return metafy((char *)text, len, META_HEAPDUP);
+}
+
+/**/
+static void
+set_predisplay(Param pm, char *x)
+{
+ set_prepost(&predisplay, &predisplaylen, x);
+}
+
+/**/
+static char *
+get_predisplay(Param pm)
+{
+ return get_prepost(predisplay, predisplaylen);
+}
+
+/**/
+static void
+set_postdisplay(Param pm, char *x)
+{
+ set_prepost(&postdisplay, &postdisplaylen, x);
+}
+
+/**/
+static char *
+get_postdisplay(Param pm)
+{
+ return get_prepost(postdisplay, postdisplaylen);
+}