about summary refs log tree commit diff
path: root/Src/prompt.c
diff options
context:
space:
mode:
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++;
 	}