From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7112 invoked from network); 25 Apr 1999 06:58:12 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 25 Apr 1999 06:58:12 -0000 Received: (qmail 23925 invoked by alias); 25 Apr 1999 06:58:00 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6096 Received: (qmail 23914 invoked from network); 25 Apr 1999 06:57:58 -0000 To: zsh-workers@sunsite.auc.dk Path: mason From: mason@primenet.com.au (Geoff Wing) Newsgroups: lists.zsh.workers Subject: Re: Patch available for 3.0.6-pre-0 Date: 25 Apr 1999 06:57:50 GMT Organization: PrimeNet Computer Consultants Distribution: local Message-ID: References: <199904221543.AAA09973@pop1.ngy.3web.ne.jp> <990423225356.ZM26290@candle.brasslantern.com> Reply-To: mason@primenet.com.au NNTP-Posting-Host: coral.primenet.com.au X-Trace: coral.primenet.com.au 925023470 7024 203.43.15.2 (25 Apr 1999 06:57:50 GMT) X-Complaints-To: usenet@coral.primenet.com.au NNTP-Posting-Date: 25 Apr 1999 06:57:50 GMT User-Agent: slrn/0.9.5.4 (UNIX) Bart Schaefer 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 Mobile : (Australia) 0413 431 874 <<