From f57d2c62e896a2017f72956c72d873a67259004a Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sat, 12 Jan 2019 15:09:52 -0500 Subject: Set PSlit like NetBSD sh --- bin/cash/histedit.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/bin/cash/histedit.c b/bin/cash/histedit.c index 3c77c6e8..92d8170a 100644 --- a/bin/cash/histedit.c +++ b/bin/cash/histedit.c @@ -177,10 +177,26 @@ 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); +setpslit(const char *lit_ch) { + wchar_t wc; + + if (!(iflag && editing && el)) + return; + + if (lit_ch == NULL) { + el_set(el, EL_PROMPT, getprompt); + el_set(el, EL_RPROMPT, getrprompt); + return; + } + + mbtowc(&wc, NULL, 1); /* state init */ + + if (mbtowc(&wc, lit_ch, strlen(lit_ch)) <= 0) { + el_set(el, EL_PROMPT, getprompt); + el_set(el, EL_RPROMPT, getrprompt); + } else { + el_set(el, EL_PROMPT_ESC, getprompt, (int)wc); + el_set(el, EL_RPROMPT_ESC, getrprompt, (int)wc); } } -- cgit 1.4.1 able class='tabs'> about summary refs log tree commit diff
path: root/chat.h (unfollow)
Commit message (Expand)Author
2022-02-12Copy RPP defines from oconfigureJune McEnroe