From 1a3bc6209c60bea2a26b0ed69628308f1e59ab32 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Wed, 23 Dec 2020 16:21:24 -0500 Subject: dash: Fix multi-line prompts when right prompts are used editline does not render a multi-line PS1 correctly when RPS1 is also set. To work around this, return only the last line of the cached prompt to editline, and print the leading lines separately inside setprompt. --- src/parser.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/parser.c b/src/parser.c index 444fa08..985b51d 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1601,7 +1601,7 @@ STATIC void setprompt(int which) { struct stackmark smark; - const char *prompt, *rprompt; + const char *prompt, *rprompt, *nl; int show; needprompt = 0; @@ -1641,6 +1641,10 @@ setprompt(int which) free(rpromptcache); promptcache = savestr(expandstr(prompt)); rpromptcache = savestr(expandstr(rprompt)); + + nl = strrchr(promptcache, '\n'); + if (nl) + outmem(promptcache, &nl[1] - promptcache, out2); } popstackmark(&smark); } @@ -1651,7 +1655,14 @@ setprompt(int which) const char * getprompt(void *unused) { - return promptcache; + const char *nl; + + nl = strrchr(promptcache, '\n'); + + if (nl) + return &nl[1]; + else + return promptcache; } const char * -- cgit 1.4.1 de1de2c71a49a4c70b9e14904&follow=1'>commit diff
path: root/rc.d/litterbox (unfollow)
Commit message (Expand)Author
2020-01-20Use Xr for first "litterbox" in README 1.0June McEnroe
2020-01-20Introduce pounce link in READMEJune McEnroe
2020-01-18Use < for beforeJune McEnroe
2020-01-18Rearrange code in scoopJune McEnroe
2020-01-16Add scoop flag for local timeJune McEnroe
2020-01-14Remove note about usernames for pounceJune McEnroe
2020-01-14Reference IRCv3.1 SASL specJune McEnroe
2020-01-14Ensure ansi resets formatting and null-terminatesJune McEnroe
2020-01-14Implement IRC formatting to ANSI translationJune McEnroe
2020-01-14Add -b flag for live backupJune McEnroe
2020-01-14Add columnsize = 0 option to FTS indexJune McEnroe
2020-01-12Add option for client cert and SASL EXTERNALJune McEnroe
2020-01-12Add Linux.mkJune McEnroe
2020-01-11Fix unscoop dedup window syntaxJune McEnroe
2020-01-11Bump busy timeout to 10sJune McEnroe