about summary refs log tree commit diff
path: root/Src/prompt.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-05-02 15:19:50 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-05-02 15:19:50 +0000
commit53d36e795b26a945048e7a87a1a91224f8e1663a (patch)
treeaee8b11f48f2af1aceacd4a279f1d4b1de6ebfa6 /Src/prompt.c
parent206237c8ec4b7619d9e70a75004cd1ae1066b0a0 (diff)
downloadzsh-53d36e795b26a945048e7a87a1a91224f8e1663a.tar.gz
zsh-53d36e795b26a945048e7a87a1a91224f8e1663a.tar.xz
zsh-53d36e795b26a945048e7a87a1a91224f8e1663a.zip
zsh-3.1.5-pws-17 dot-zsh-199905041932
Diffstat (limited to 'Src/prompt.c')
-rw-r--r--Src/prompt.c19
1 files changed, 13 insertions, 6 deletions
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++;
 	}