summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/cash/histedit.c24
1 files 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);
 	}
 }
 
/txt/music.txt?id=91e5b792092d64579d8927d5ad4bbafbe6bc0350&follow=1'>Add Four Tet — HandsJune McEnroe 2020-02-12Simplify macOS notify-sendJune McEnroe 2020-02-12Add imbox and notemap to pageJune McEnroe 2020-02-12Collapse simple linksJune McEnroe 2020-02-12Move catgirl up the pageJune McEnroe 2020-02-12Update catgirl pty grabJune McEnroe 2020-02-12Link to cgit /about pages where appropriateJune McEnroe 2020-02-11Separate LINKS from BINS for html to workJune McEnroe 2020-02-11Add margin to Bl-bullet itemsJune McEnroe 2020-02-10Match URLs inside parens or with paired parens insideJune McEnroe 2020-02-10Duplicate effective URL before passing it back to curlJune McEnroe 2020-02-09Add To Be Taught, If FortunateJune McEnroe 2020-02-04Add The Future of Another TimelineJune McEnroe 2020-01-31Reorganize the Makefile for the umpteenth timeJune McEnroe 2020-01-28Change scout sensitivity to 1.4June McEnroe 2020-01-28Import shows.txtJune McEnroe