From 037d883e568435859c61c46f00282ba2d9277d7c Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Fri, 11 Jan 2019 13:59:39 -0500 Subject: Add PSlit for prompt escapes --- bin/cash/histedit.c | 8 ++++++++ bin/cash/myhistedit.h | 1 + bin/cash/var.c | 3 +++ 3 files changed, 12 insertions(+) (limited to 'bin/cash') 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 @@ -176,6 +176,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) { 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 -- cgit 1.4.1