Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Patch available for 3.0.6-pre-0
- X-seq: zsh-workers 6096
- From: mason@xxxxxxxxxxxxxxx (Geoff Wing)
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: Patch available for 3.0.6-pre-0
- Date: 25 Apr 1999 06:57:50 GMT
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- Organization: PrimeNet Computer Consultants
- References: <199904221543.AAA09973@xxxxxxxxxxxxxxxxxxx> <990423225356.ZM26290@xxxxxxxxxxxxxxxxxxxxxxx>
- Reply-to: mason@xxxxxxxxxxxxxxx
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> typed:
:On Apr 23, 12:07am, Tatsuo Furukawa wrote:
:I'd like at least Geoff's opinion before I commit to doing anything with
:this patch. In particular, emitting the ch capability may require up to
:six or seven bytes, where a relative horizontal or vertical move might
:require fewer (depending on distance). I'm not sure just how optimized
:this code is supposed to be. Also, the "if (pos <= vcs / 2)" test may be
:optimizing for an absolute move by tc_rightcurs(), and may not be as good
:any longer if tc_rightcurs() makes a relative motion. Geoff's the expert
:on what's supposed to be happening in here.
OK, I tried to find my notes here on a couple of items but failed - the
stacks of paper were just too big :-( - so a couple of comments here are
from memory.
* tab output is more of a last resort type thing though it has taken
precendence over outputing the rest of the line. The reason it's not
preferred is that I'm not sure we can presume we know the absolute
position of the cursor and the prompt within the prompt line.
Why? ``setopt nopromptcr''
* I've moved the outputing of absolute cursor movement to just before tab
movement which probably needs enhancing anyway since it's presuming
tab positions of 8 which while not unreasonable is not necessarily
correct (on maybe 0.0001% of terminals)
* On another topic, I've still got to look through Sven's CLEAREOD solution
which I _really_ dislike the look of. Of course, if it is necessary ....
This is a replacement for the zle_refresh.c patch (not the globals.h or
zsh.h patch parts) moving a couple of things around and moving comments
back to their appropriate spot. I've compiled it but haven't tested it
a lot yet. It's against virgin 3.0.5 sources. Comments welcome.
*** zle_refresh.c.~1~ Fri Sep 26 11:42:19 1997
--- zle_refresh.c Sun Apr 25 16:34:26 1999
***************
*** 808,827 ****
}
}
! if (cl == vcs)
! return;
!
! /* choose cheapest movements for ttys without multiple movement capabilities -
! do this now because it's easier (to code) */
! if (cl <= vcs / 2) {
! zputc('\r', shout);
! vcs = 0;
! }
! if (vcs < cl)
! tc_rightcurs(cl);
! else if (vcs > cl)
! tc_leftcurs(vcs - cl);
! vcs = cl;
}
/**/
--- 808,815 ----
}
}
! if (cl != vcs)
! singmoveto(cl);
}
/**/
***************
*** 839,854 ****
return 0;
}
/**/
void
! tc_rightcurs(int cl)
{
! int ct, /* number of characters to move across */
i = vcs, /* cursor position after initial movements */
j;
char *t;
! ct = cl - vcs;
/* do a multright if we can - it's the most reliable */
if (tccan(TCMULTRIGHT)) {
--- 827,843 ----
return 0;
}
+ /* ct: number of characters to move across */
/**/
void
! tc_rightcurs(int ct)
{
! int cl, /* ``desired'' absolute horizontal position */
i = vcs, /* cursor position after initial movements */
j;
char *t;
! cl = ct + vcs;
/* do a multright if we can - it's the most reliable */
if (tccan(TCMULTRIGHT)) {
***************
*** 856,861 ****
--- 845,857 ----
return;
}
+ /* do an absolute horizontal position if we can */
+ if (tccan(TCHORIZPOS)) {
+ tcoutarg(TCHORIZPOS, cl);
+ return;
+ }
+
+ /* XXX: should really check "it" in termcap and use / and % */
/* try tabs if tabs are non destructive and multright is not possible */
if (!oxtabs && tccan(TCNEXTTAB) && ((vcs | 7) < cl)) {
i = (vcs | 7) + 1;
***************
*** 1060,1082 ****
{
if (pos == vcs)
return;
! if (pos <= vcs / 2) {
zputc('\r', shout);
vcs = 0;
}
! if (pos < vcs) {
tc_leftcurs(vcs - pos);
! vcs = pos;
! }
! if (pos > vcs) {
! if (tcmultout(TCRIGHT, TCMULTRIGHT, pos - vcs))
! vcs = pos;
! else
! while (pos > vcs) {
! zputc(nbuf[0][vcs], shout);
! vcs++;
! }
! }
}
/* generate left and right prompts */
--- 1056,1076 ----
{
if (pos == vcs)
return;
!
! /* choose cheapest movements for ttys without multiple movement capabilities -
! do this now because it's easier (to code) */
!
! if ((!tccan(TCMULTLEFT) || pos == 0) && (pos <= vcs / 2)) {
zputc('\r', shout);
vcs = 0;
}
!
! if (pos < vcs)
tc_leftcurs(vcs - pos);
! else if (pos > vcs)
! tc_rightcurs(pos - vcs);
!
! vcs = pos;
}
/* generate left and right prompts */
--
Geoff Wing <gcw@xxxxxxxxx> Mobile : (Australia) 0413 431 874 <<<new
Work URL: http://www.primenet.com.au/ Ego URL: http://pobox.com/~gcw/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author