mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-06-17 09:08:04 +02:00
zsh-workers:6104
This commit is contained in:
parent
cb801a0103
commit
9d0a98e05f
2 changed files with 24 additions and 10 deletions
Src
|
@ -96,6 +96,7 @@ static int more_start, /* more text before start of screen? */
|
|||
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,8 +142,14 @@ resetvideo(void)
|
|||
*obuf[ln] = '\0';
|
||||
}
|
||||
|
||||
countprompt(lpromptbuf, &lpromptw, &lprompth);
|
||||
countprompt(rpromptbuf, &rpromptw, &rprompth);
|
||||
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,7 +334,7 @@ zrefresh(void)
|
|||
vcs = 0;
|
||||
else if (!clearflag && lpromptbuf[0]) {
|
||||
zputs(lpromptbuf, shout);
|
||||
if (lpromptw == 0 && lprompth == 1)
|
||||
if (lpromptwof == winw)
|
||||
zputs("\n", shout); /* works with both hasam and !hasam */
|
||||
}
|
||||
if (clearflag) {
|
||||
|
@ -947,7 +954,7 @@ tc_rightcurs(int cl)
|
|||
zputc('\r', shout);
|
||||
tc_upcurs(lprompth - 1);
|
||||
zputs(lpromptbuf, shout);
|
||||
if (lpromptw == 0 && lprompth == 1)
|
||||
if (lpromptwof == winw)
|
||||
zputs("\n", shout); /* works with both hasam and !hasam */
|
||||
}
|
||||
i = lpromptw;
|
||||
|
|
19
Src/prompt.c
19
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++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue