From 53d36e795b26a945048e7a87a1a91224f8e1663a Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Sun, 2 May 1999 15:19:50 +0000 Subject: zsh-3.1.5-pws-17 --- Src/prompt.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'Src/prompt.c') diff --git a/Src/prompt.c b/Src/prompt.c index 69823a5e3..ad7cdbc31 100644 --- a/Src/prompt.c +++ b/Src/prompt.c @@ -232,7 +232,7 @@ putpromptchar(int doprint, int endchar) break; case 'l': *bp = '\0'; - countprompt(bufline, &t0, 0); + countprompt(bufline, &t0, 0, 0); if (t0 >= arg) test = 1; break; @@ -678,11 +678,15 @@ putstr(int d) /**/ void -countprompt(char *str, int *wp, int *hp) +countprompt(char *str, int *wp, int *hp, int overf) { int w = 0, h = 1; int s = 1; for(; *str; str++) { + if(w >= columns) { + w = 0; + h++; + } if(*str == Meta) str++; if(*str == Inpar) @@ -694,12 +698,15 @@ countprompt(char *str, int *wp, int *hp) else if(s) { if(*str == '\t') w = (w | 7) + 1; - else if(*str == '\n') - w = columns; - else + else if(*str == '\n') { + w = 0; + h++; + } else w++; } - if(w >= columns) { + } + if(w >= columns) { + if (!overf || w > columns) { w = 0; h++; } -- cgit 1.4.1