From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13206 invoked from network); 25 Apr 1999 15:23:12 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 25 Apr 1999 15:23:12 -0000 Received: (qmail 18501 invoked by alias); 25 Apr 1999 15:22:55 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6104 Received: (qmail 18494 invoked from network); 25 Apr 1999 15:22:47 -0000 To: zsh-workers@sunsite.auc.dk Path: mason From: mason@primenet.com.au (Geoff Wing) Newsgroups: lists.zsh.workers Subject: PATCH: 3.1.5-pws-15: multiline prompt Date: 25 Apr 1999 15:22:30 GMT Organization: PrimeNet Computer Consultants Distribution: local Message-ID: References: Reply-To: mason@primenet.com.au NNTP-Posting-Host: coral.primenet.com.au X-Trace: coral.primenet.com.au 925053750 13180 203.43.15.2 (25 Apr 1999 15:22:30 GMT) X-Complaints-To: usenet@coral.primenet.com.au NNTP-Posting-Date: 25 Apr 1999 15:22:30 GMT User-Agent: slrn/0.9.5.4 (UNIX) Heyla, see discussion under "yet another undesired 3.1.5-pws-15 change" This should do what you want: *** prompt.c.org Thu Nov 12 03:04:38 1998 --- prompt.c Mon Apr 26 01:15:25 1999 *************** *** 232,238 **** break; case 'l': *bp = '\0'; ! countprompt(bufline, &t0, 0); if (t0 >= arg) test = 1; break; --- 232,238 ---- break; case 'l': *bp = '\0'; ! countprompt(bufline, &t0, 0, 0); if (t0 >= arg) test = 1; break; *************** *** 678,688 **** /**/ void ! countprompt(char *str, int *wp, int *hp) { int w = 0, h = 1; int s = 1; for(; *str; str++) { if(*str == Meta) str++; if(*str == Inpar) --- 678,692 ---- /**/ void ! 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,705 **** else if(s) { if(*str == '\t') w = (w | 7) + 1; ! else if(*str == '\n') ! w = columns; ! else w++; } ! if(w >= columns) { w = 0; h++; } --- 698,712 ---- else if(s) { if(*str == '\t') w = (w | 7) + 1; ! else if(*str == '\n') { ! w = 0; ! h++; ! } else w++; } ! } ! if(w >= columns) { ! if (!overf || w > columns) { w = 0; h++; } *** Zle/zle_refresh.c.org Tue Apr 13 18:07:18 1999 --- Zle/zle_refresh.c Mon Apr 26 01:11:29 1999 *************** *** 96,101 **** --- 96,102 ---- olnct, /* previous number of lines */ ovln, /* previous video cursor position line */ lpromptw, rpromptw, /* prompt widths on screen */ + lpromptwof, /* left prompt width with real end position */ lprompth, /* lines taken up by the prompt */ rprompth, /* right prompt height */ vcs, vln, /* video cursor position column & line */ *************** *** 141,148 **** *obuf[ln] = '\0'; } ! countprompt(lpromptbuf, &lpromptw, &lprompth); ! countprompt(rpromptbuf, &rpromptw, &rprompth); if (lpromptw) { memset(nbuf[0], ' ', lpromptw); --- 142,155 ---- *obuf[ln] = '\0'; } ! countprompt(lpromptbuf, &lpromptwof, &lprompth, 1); ! countprompt(rpromptbuf, &rpromptw, &rprompth, 0); ! if (lpromptwof != winw) ! lpromptw = lpromptwof; ! else { ! lpromptw = 0; ! lprompth++; ! } if (lpromptw) { memset(nbuf[0], ' ', lpromptw); *************** *** 327,333 **** vcs = 0; else if (!clearflag && lpromptbuf[0]) { zputs(lpromptbuf, shout); ! if (lpromptw == 0) zputs("\n", shout); /* works with both hasam and !hasam */ } if (clearflag) { --- 334,340 ---- vcs = 0; else if (!clearflag && lpromptbuf[0]) { zputs(lpromptbuf, shout); ! if (lpromptwof == winw) zputs("\n", shout); /* works with both hasam and !hasam */ } if (clearflag) { *************** *** 947,953 **** zputc('\r', shout); tc_upcurs(lprompth - 1); zputs(lpromptbuf, shout); ! if (lpromptw == 0) zputs("\n", shout); /* works with both hasam and !hasam */ } i = lpromptw; --- 954,960 ---- zputc('\r', shout); tc_upcurs(lprompth - 1); zputs(lpromptbuf, shout); ! if (lpromptwof == winw) zputs("\n", shout); /* works with both hasam and !hasam */ } i = lpromptw; -- Geoff Wing Mobile : (Australia) 0413 431 874 <<