diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-12-29 06:59:43 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-12-29 06:59:43 +0000 |
commit | 0ea40a75dd27b82ec63c8b4dbd0f46c5ef125e86 (patch) | |
tree | 71c78229538b3672d83031a472d6b048e7684b27 | |
parent | 3a94c0d71d0e512694035d925f20b19623566acf (diff) |
in prompt variable parsing, if either \n or \r (the two character
sequences) are detected reset the "pointer to first character in
last line of prompt" and "length of last line of prompt" variables,
just like how it done for \n (the literal character). this fixes
cursor movement for prompts with those sequences embedded within
ok jmc pval
-rw-r--r-- | bin/ksh/lex.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/ksh/lex.c b/bin/ksh/lex.c index 762298e8eda..2fe8a5578d1 100644 --- a/bin/ksh/lex.c +++ b/bin/ksh/lex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lex.c,v 1.30 2004/12/22 18:57:28 otto Exp $ */ +/* $OpenBSD: lex.c,v 1.31 2004/12/29 06:59:42 deraadt Exp $ */ /* * lexical analysis and source input @@ -1251,10 +1251,14 @@ dopprompt(const char *sp, int ntruncate, const char **spp, int doprint) case 'n': /* '\' 'n' newline */ strbuf[0] = '\n'; strbuf[1] = '\0'; + totlen = 0; /* reset for prompt re-print */ + sp = cp + 1; break; case 'r': /* '\' 'r' return */ strbuf[0] = '\r'; strbuf[1] = '\0'; + totlen = 0; /* reset for prompt re-print */ + sp = cp + 1; break; case 's': /* '\' 's' basename $0 */ strlcpy(strbuf, kshname, sizeof strbuf); |