Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Second zle_refresh.c patch
- X-seq: zsh-workers 1642
- From: Geoff Wing <mason@xxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (zsh-list)
- Subject: Second zle_refresh.c patch
- Date: Mon, 15 Jul 1996 01:34:16 +1000 (EST)
Heyla,
and here's patch number 2. Changes are:
* match of only one character doesn't have it use termcap RIGHT or non-
destructive space (don't output three or more characters to save one).
* a much nicer handling of automargin stuff (especially for those who
want to cut and paste multiple lines from their prompt in an xterm)
* got rid of a bogus warning Bart Schaefer's compiler throws out.
* fixed an insert bug causing bad displays when termcap INSERT is used
followed by DELETE (characters pushed off the right are dead)
*** zle_refresh.c.~1~ Sun Jul 14 01:50:22 1996
--- zle_refresh.c Mon Jul 15 01:16:23 1996
***************
*** 110,116 ****
}
/*
! * Jul 96: changed to single line scroll for higher speed terminals - mason
* I've seperated the loops for readability (and it's slightly faster)
* Returns line number to be used next
*/
--- 110,116 ----
}
/*
! * Jul 96: <mason> changed to single line scroll for higher speed terminals
* I've seperated the loops for readability (and it's slightly faster)
* Returns line number to be used next
*/
***************
*** 196,202 ****
int ln = 0, /* current line we're working on */
nvcs = 0, nvln = -1, /* video cursor column and line */
t0 = -1, /* tmp */
! tosln; /* tmp in statusline stuff */
unsigned char *s, /* pointer into the video buffer */
*t, /* pointer into the real buffer */
*sen, /* pointer to end of the video buffer (eol) */
--- 196,202 ----
int ln = 0, /* current line we're working on */
nvcs = 0, nvln = -1, /* video cursor column and line */
t0 = -1, /* tmp */
! tosln = 0; /* tmp in statusline stuff */
unsigned char *s, /* pointer into the video buffer */
*t, /* pointer into the real buffer */
*sen, /* pointer to end of the video buffer (eol) */
***************
*** 541,551 ****
}
}
/* 3: main display loop - write out the buffer using whatever tricks we can */
for (;;) {
! /* skip past all matching characters */
! for (; *nl && (*nl == *ol); nl++, ol++, ccs++) ;
if (!*nl) {
if ((char_ins <= 0) || (ccs >= winw)) /* written everything */
--- 541,563 ----
}
}
+ /* 2b: first a new trick for automargin niceness - good for cut and paste */
+
+ if (hasam && vcs == winw) {
+ vln++, vcs = 1;
+ putc(*nbuf[vln], shout);
+ nl++;
+ if (*ol)
+ ol++;
+ ccs = 1;
+ }
+
/* 3: main display loop - write out the buffer using whatever tricks we can */
for (;;) {
! if (*nl && nl[1] == ol[1]) /* skip only if second chars match */
! /* skip past all matching characters */
! for (; *nl && (*nl == *ol); nl++, ol++, ccs++) ;
if (!*nl) {
if ((char_ins <= 0) || (ccs >= winw)) /* written everything */
***************
*** 595,608 ****
}
/* inserting & deleting chars: we can if there's no right-prompt */
! if ((ln || !put_rpmpt || !oput_rpmpt)) {
/* deleting characters - see if we can find a match series that
makes it cheaper to delete intermediate characters
eg. oldline: hifoobar } hopefully cheaper here to delete two
newline: foobar } characters, then we have six matches */
!
! if (tccan(TCDEL) && nl[1] && ol[1] && (ol[1] != nl[1])) {
for (i = 0, p1 = ol; *p1; p1++, i++)
if (tcdelcost(i) < pfxlen(p1, nl)) {
tc_delchars(i);
--- 607,620 ----
}
/* inserting & deleting chars: we can if there's no right-prompt */
! if ((ln || !put_rpmpt || !oput_rpmpt)
! && (nl[1] && ol[1] && nl[1] != ol[1])) {
/* deleting characters - see if we can find a match series that
makes it cheaper to delete intermediate characters
eg. oldline: hifoobar } hopefully cheaper here to delete two
newline: foobar } characters, then we have six matches */
! if (tccan(TCDEL)) {
for (i = 0, p1 = ol; *p1; p1++, i++)
if (tcdelcost(i) < pfxlen(p1, nl)) {
tc_delchars(i);
***************
*** 618,625 ****
annihilated, but we don't do this if we're on the last line lest
undesired scrolling occurs due to `illegal' characters on screen */
! if ((vln != lines - 1) && /* not on last line */
! tccan(TCINS) && nl[1] && ol[1] && (ol[1] != nl[1])) {
for (i = 0, p1 = nl; *p1; p1++, i++)
if (tcinscost(i) < pfxlen(p1, ol)) {
tc_inschars(i);
--- 630,636 ----
annihilated, but we don't do this if we're on the last line lest
undesired scrolling occurs due to `illegal' characters on screen */
! if (tccan(TCINS) && (vln != lines - 1)) { /* not on last line */
for (i = 0, p1 = nl; *p1; p1++, i++)
if (tcinscost(i) < pfxlen(p1, ol)) {
tc_inschars(i);
***************
*** 628,633 ****
--- 639,650 ----
ccs = (vcs += i);
nl = p1;
char_ins += i;
+ /* if we've pushed off the right, trucate oldline */
+ for (j = ccs, p1 = ol; *p1 && j + char_ins < winw;
+ p1++, j++);
+ if (j + char_ins == winw)
+ *p1 = '\0';
+ p1 = ol;
break;
}
if (*p1)
--
Mason [G.C.W] mason@xxxxxxxxxxxxxxxxxx "Hurt...Agony...Pain...LOVE-IT"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author