zsh-workers
 help / color / mirror / code / Atom feed
From: mason@primenet.com.au (Geoff Wing)
To: zsh-workers@sunsite.auc.dk
Subject: Re: Patch available for 3.0.6-pre-0
Date: 25 Apr 1999 06:57:50 GMT	[thread overview]
Message-ID: <slrn7i5f7d.5bm.mason@coral.primenet.com.au> (raw)
In-Reply-To: <990423225356.ZM26290@candle.brasslantern.com>

Bart Schaefer <schaefer@brasslantern.com> 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@pobox.com>            Mobile : (Australia) 0413 431 874 <<<new
Work URL: http://www.primenet.com.au/   Ego URL: http://pobox.com/~gcw/


  reply	other threads:[~1999-04-25  6:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-21  8:15 Bart Schaefer
1999-04-21  8:47 ` Peter Stephenson
1999-04-21 14:14 ` Tatsuo Furukawa
1999-04-21 16:05   ` Bart Schaefer
1999-04-22 15:07     ` Tatsuo Furukawa
1999-04-24  5:53       ` Bart Schaefer
1999-04-25  6:57         ` Geoff Wing [this message]
1999-04-26 15:22           ` Tatsuo Furukawa
1999-04-27 16:24             ` Bart Schaefer
1999-04-21 23:52 ` Wayne Davison
1999-04-24  4:32   ` Bart Schaefer
1999-04-24  7:12     ` Wayne Davison
1999-04-23 12:48 Sven Wischnowsky
1999-04-23 14:13 Sven Wischnowsky

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=slrn7i5f7d.5bm.mason@coral.primenet.com.au \
    --to=mason@primenet.com.au \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).