From: Geoff Wing <gwing@primenet.com.au>
To: zsh-workers@math.gatech.edu (zsh-workers)
Subject: zle_refresh.c patch
Date: Mon, 14 Oct 1996 11:14:24 +1000 (EST) [thread overview]
Message-ID: <199610140114.LAA08554@coral.primenet.com.au> (raw)
Heyla,
here's an optimisation and bug fix. Bart Schaefer's problem from 2202
should be fixed, and the optimisation will prevent a lot of infrequent but
unnecessary code in most people's cases. There are also a couple more
necessary checks.
bye
*** zle_refresh.c.~3~ Tue Oct 8 12:10:00 1996
--- zle_refresh.c Mon Oct 14 11:06:35 1996
***************
*** 501,506 ****
--- 501,516 ----
ol = obuf[ln] ? obuf[ln] : "";
ollen = strlen(ol);
+ /* optimisation: can easily happen for clearing old lines. If the terminal has
+ the capability, then this is the easiest way to skip unnecessary stuff */
+ if (cleareol && !nllen && !(hasam && ln < nlnct - 1)
+ && tccan(TCCLEAREOL)) {
+ moveto(ln, 0);
+ tcout(TCCLEAREOL);
+ SELECT_ADD_COST(tclen[TCCLEAREOL]);
+ return;
+ }
+
/* 1: pad out the new buffer with spaces to contain _all_ of the characters
which need to be written. do this now to allow some pre-processing */
***************
*** 515,521 ****
if (ln && nbuf[ln])
strncpy(nl, p1, winw + 1); /* next time obuf will be up-to-date */
else
! nl = p1; /* don't keep padding for prompt line */
nllen = winw;
} else if (ollen > nllen) { /* make new line at least as long as old */
p1 = halloc(ollen + 1);
--- 525,531 ----
if (ln && nbuf[ln])
strncpy(nl, p1, winw + 1); /* next time obuf will be up-to-date */
else
! nl = p1; /* don't keep the padding for prompt line */
nllen = winw;
} else if (ollen > nllen) { /* make new line at least as long as old */
p1 = halloc(ollen + 1);
***************
*** 548,554 ****
if (hasam && vcs == winw) {
vln++, vcs = 1;
! putc(*nbuf[vln], shout);
nl++;
if (*ol)
ol++;
--- 558,567 ----
if (hasam && vcs == winw) {
vln++, vcs = 1;
! if (nbuf[vln] && *nbuf[vln])
! putc(*nbuf[vln], shout);
! else
! putc(' ', shout); /* I don't think this should happen */
nl++;
if (*ol)
ol++;
***************
*** 810,816 ****
if (lpptlen == pptw) {
SELECT_ADD_COST(lpptlen - i);
fwrite(lpptbuf + i, lpptlen - i, 1, shout);
! } else if (tclen[TCRIGHT] * ct < lpptlen) {
/* it is cheaper to send TCRIGHT than reprint the whole prompt */
SELECT_ADD_COST(ct);
for ( ; ct--; )
--- 823,829 ----
if (lpptlen == pptw) {
SELECT_ADD_COST(lpptlen - i);
fwrite(lpptbuf + i, lpptlen - i, 1, shout);
! } else if (tccan(TCRIGHT) && (tclen[TCRIGHT] * ct < lpptlen)) {
/* it is cheaper to send TCRIGHT than reprint the whole prompt */
SELECT_ADD_COST(ct);
for ( ; ct--; )
***************
*** 828,837 ****
}
SELECT_ADD_COST(ct);
! for (j = 0, t = nbuf[vln]; *t && (j < i); j++, t++);
! if (j == i)
! for ( ; *t && ct; ct--, t++)
! putc(*t, shout);
while (ct--)
putc(' ', shout); /* not my fault your terminal can't go right */
}
--- 841,852 ----
}
SELECT_ADD_COST(ct);
! if (nbuf[vln]) {
! for (j = 0, t = nbuf[vln]; *t && (j < i); j++, t++);
! if (j == i)
! for ( ; *t && ct; ct--, t++)
! putc(*t, shout);
! }
while (ct--)
putc(' ', shout); /* not my fault your terminal can't go right */
}
--
Geoff Wing [gwing@primenet.com.au] PrimeNet - Internet Consultancy
Web: http://www.primenet.com.au/ Facsimile: +61-3-9819 3788
next reply other threads:[~1996-10-14 1:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-10-14 1:14 Geoff Wing [this message]
1996-10-14 1:57 ` Bart Schaefer
-- strict thread matches above, loose matches on Subject: below --
1995-07-06 19:30 Geoff Wing
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199610140114.LAA08554@coral.primenet.com.au \
--to=gwing@primenet.com.au \
--cc=zsh-workers@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).