summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-01-11 13:59:39 -0500
committerJune McEnroe <june@causal.agency>2019-01-11 13:59:39 -0500
commite9af3c7681723244c0ca305d8cc540ad4540ca80 (patch)
treecd0f26821ab2738bde4f439edaee8186a5015af6
parentDon't make depend automatically (diff)
downloadsrc-e9af3c7681723244c0ca305d8cc540ad4540ca80.tar.gz
src-e9af3c7681723244c0ca305d8cc540ad4540ca80.zip
Add PSlit for prompt escapes
Diffstat (limited to '')
-rw-r--r--bin/cash/histedit.c8
-rw-r--r--bin/cash/myhistedit.h1
-rw-r--r--bin/cash/var.c3
3 files changed, 12 insertions, 0 deletions
diff --git a/bin/cash/histedit.c b/bin/cash/histedit.c
index 581925d8..4e8ff8b2 100644
--- a/bin/cash/histedit.c
+++ b/bin/cash/histedit.c
@@ -177,6 +177,14 @@ sethistsize(const char *hs)
 }
 
 void
+setpslit(const char *lit) {
+	if (el != NULL && *lit < 0x20) {
+		el_set(el, EL_PROMPT_ESC, getprompt, *lit);
+		el_set(el, EL_RPROMPT_ESC, getrprompt, *lit);
+	}
+}
+
+void
 setterm(const char *term)
 {
 	if (rootshell && el != NULL && term != NULL)
diff --git a/bin/cash/myhistedit.h b/bin/cash/myhistedit.h
index ba39eb0e..8f1305ad 100644
--- a/bin/cash/myhistedit.h
+++ b/bin/cash/myhistedit.h
@@ -40,5 +40,6 @@ extern int displayhist;
 
 void histedit(void);
 void sethistsize(const char *);
+void setpslit(const char *);
 void setterm(const char *);
 
diff --git a/bin/cash/var.c b/bin/cash/var.c
index 54663914..e183eaa3 100644
--- a/bin/cash/var.c
+++ b/bin/cash/var.c
@@ -86,6 +86,7 @@ struct varinit {
 
 #ifndef NO_HISTORY
 struct var vhistsize;
+struct var vpslit;
 struct var vterm;
 #endif
 struct var venv;
@@ -130,6 +131,8 @@ static const struct varinit varinit[] = {
 	{ &vrps2,	VUNSET,				"RPS2=",
 	  NULL },
 #ifndef NO_HISTORY
+	{ &vpslit,	VUNSET,				"PSlit=",
+	  setpslit },
 	{ &vterm,	VUNSET,				"TERM=",
 	  setterm },
 #endif