mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-06-20 22:18:02 +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 */
|
olnct, /* previous number of lines */
|
||||||
ovln, /* previous video cursor position line */
|
ovln, /* previous video cursor position line */
|
||||||
lpromptw, rpromptw, /* prompt widths on screen */
|
lpromptw, rpromptw, /* prompt widths on screen */
|
||||||
|
lpromptwof, /* left prompt width with real end position */
|
||||||
lprompth, /* lines taken up by the prompt */
|
lprompth, /* lines taken up by the prompt */
|
||||||
rprompth, /* right prompt height */
|
rprompth, /* right prompt height */
|
||||||
vcs, vln, /* video cursor position column & line */
|
vcs, vln, /* video cursor position column & line */
|
||||||
|
@ -141,8 +142,14 @@ resetvideo(void)
|
||||||
*obuf[ln] = '\0';
|
*obuf[ln] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
countprompt(lpromptbuf, &lpromptw, &lprompth);
|
countprompt(lpromptbuf, &lpromptwof, &lprompth, 1);
|
||||||
countprompt(rpromptbuf, &rpromptw, &rprompth);
|
countprompt(rpromptbuf, &rpromptw, &rprompth, 0);
|
||||||
|
if (lpromptwof != winw)
|
||||||
|
lpromptw = lpromptwof;
|
||||||
|
else {
|
||||||
|
lpromptw = 0;
|
||||||
|
lprompth++;
|
||||||
|
}
|
||||||
|
|
||||||
if (lpromptw) {
|
if (lpromptw) {
|
||||||
memset(nbuf[0], ' ', lpromptw);
|
memset(nbuf[0], ' ', lpromptw);
|
||||||
|
@ -327,7 +334,7 @@ zrefresh(void)
|
||||||
vcs = 0;
|
vcs = 0;
|
||||||
else if (!clearflag && lpromptbuf[0]) {
|
else if (!clearflag && lpromptbuf[0]) {
|
||||||
zputs(lpromptbuf, shout);
|
zputs(lpromptbuf, shout);
|
||||||
if (lpromptw == 0 && lprompth == 1)
|
if (lpromptwof == winw)
|
||||||
zputs("\n", shout); /* works with both hasam and !hasam */
|
zputs("\n", shout); /* works with both hasam and !hasam */
|
||||||
}
|
}
|
||||||
if (clearflag) {
|
if (clearflag) {
|
||||||
|
@ -947,7 +954,7 @@ tc_rightcurs(int cl)
|
||||||
zputc('\r', shout);
|
zputc('\r', shout);
|
||||||
tc_upcurs(lprompth - 1);
|
tc_upcurs(lprompth - 1);
|
||||||
zputs(lpromptbuf, shout);
|
zputs(lpromptbuf, shout);
|
||||||
if (lpromptw == 0 && lprompth == 1)
|
if (lpromptwof == winw)
|
||||||
zputs("\n", shout); /* works with both hasam and !hasam */
|
zputs("\n", shout); /* works with both hasam and !hasam */
|
||||||
}
|
}
|
||||||
i = lpromptw;
|
i = lpromptw;
|
||||||
|
|
19
Src/prompt.c
19
Src/prompt.c
|
@ -232,7 +232,7 @@ putpromptchar(int doprint, int endchar)
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
*bp = '\0';
|
*bp = '\0';
|
||||||
countprompt(bufline, &t0, 0);
|
countprompt(bufline, &t0, 0, 0);
|
||||||
if (t0 >= arg)
|
if (t0 >= arg)
|
||||||
test = 1;
|
test = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -678,11 +678,15 @@ putstr(int d)
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
void
|
void
|
||||||
countprompt(char *str, int *wp, int *hp)
|
countprompt(char *str, int *wp, int *hp, int overf)
|
||||||
{
|
{
|
||||||
int w = 0, h = 1;
|
int w = 0, h = 1;
|
||||||
int s = 1;
|
int s = 1;
|
||||||
for(; *str; str++) {
|
for(; *str; str++) {
|
||||||
|
if(w >= columns) {
|
||||||
|
w = 0;
|
||||||
|
h++;
|
||||||
|
}
|
||||||
if(*str == Meta)
|
if(*str == Meta)
|
||||||
str++;
|
str++;
|
||||||
if(*str == Inpar)
|
if(*str == Inpar)
|
||||||
|
@ -694,12 +698,15 @@ countprompt(char *str, int *wp, int *hp)
|
||||||
else if(s) {
|
else if(s) {
|
||||||
if(*str == '\t')
|
if(*str == '\t')
|
||||||
w = (w | 7) + 1;
|
w = (w | 7) + 1;
|
||||||
else if(*str == '\n')
|
else if(*str == '\n') {
|
||||||
w = columns;
|
w = 0;
|
||||||
else
|
h++;
|
||||||
|
} else
|
||||||
w++;
|
w++;
|
||||||
}
|
}
|
||||||
if(w >= columns) {
|
}
|
||||||
|
if(w >= columns) {
|
||||||
|
if (!overf || w > columns) {
|
||||||
w = 0;
|
w = 0;
|
||||||
h++;
|
h++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue