From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8010 invoked from network); 12 May 1999 15:48:20 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 12 May 1999 15:48:20 -0000 Received: (qmail 15067 invoked by alias); 12 May 1999 15:47:52 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6274 Received: (qmail 15055 invoked from network); 12 May 1999 15:47:25 -0000 Message-Id: <199905121547.AAA05861@pop1.ngy.3web.ne.jp> From: Tatsuo Furukawa To: zsh-workers@sunsite.auc.dk Subject: PATCH: right cursor movement patch (for zsh-3.1.5-pws-18) Date: Thu, 13 May 1999 00:49:09 +0900 X-Dispatcher: impost version 0.99i (Apr. 6, 1997) Hello, zsh developpers. Here is a patch for "right cursor movement" problem. This problem is reported in 6069. And it is already fixed in 3.0.6-pre-2. But 3.1.5-pws-18 still has this problem. So, I made the patch. This is the re-writed version for 6116. diff -ur zsh-3.1.5-pws-18.orig/Src/Zle/zle_refresh.c zsh-3.1.5-pws-18/Src/Zle/zle_refresh.c --- zsh-3.1.5-pws-18.orig/Src/Zle/zle_refresh.c Thu Apr 29 16:51:57 1999 +++ zsh-3.1.5-pws-18/Src/Zle/zle_refresh.c Wed May 12 12:14:49 1999 @@ -881,20 +881,8 @@ } } - 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; + if (cl != vcs) + singmoveto(cl); } /**/ @@ -912,16 +900,17 @@ return 0; } +/* ct: number of characters to move across */ /**/ static void -tc_rightcurs(int cl) +tc_rightcurs(int ct) { - int ct, /* number of characters to move across */ + int cl, /* ``desired'' absolute horizontal position */ i = vcs, /* cursor position after initial movements */ j; char *t; - ct = cl - vcs; + cl = ct + vcs; /* do a multright if we can - it's the most reliable */ if (tccan(TCMULTRIGHT)) { @@ -929,6 +918,13 @@ 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; @@ -1137,21 +1133,19 @@ { if (pos == vcs) return; - if (pos <= vcs / 2) { + +/* 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) { + + 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++; - } - } + else if (pos > vcs) + tc_rightcurs(pos - vcs); + + vcs = pos; } diff -ur zsh-3.1.5-pws-18.orig/Src/init.c zsh-3.1.5-pws-18/Src/init.c --- zsh-3.1.5-pws-18.orig/Src/init.c Sat May 8 21:48:46 1999 +++ zsh-3.1.5-pws-18/Src/init.c Wed May 12 12:14:49 1999 @@ -414,7 +414,7 @@ static char *tccapnams[TC_COUNT] = { "cl", "le", "LE", "nd", "RI", "up", "UP", "do", "DO", "dc", "DC", "ic", "IC", "cd", "ce", "al", "dl", "ta", - "md", "so", "us", "me", "se", "ue" + "md", "so", "us", "me", "se", "ue", "ch" }; /* Initialise termcap */ diff -ur zsh-3.1.5-pws-18.orig/Src/zsh.h zsh-3.1.5-pws-18/Src/zsh.h --- zsh-3.1.5-pws-18.orig/Src/zsh.h Tue May 11 21:54:58 1999 +++ zsh-3.1.5-pws-18/Src/zsh.h Wed May 12 12:14:50 1999 @@ -1298,7 +1298,8 @@ #define TCALLATTRSOFF 21 #define TCSTANDOUTEND 22 #define TCUNDERLINEEND 23 -#define TC_COUNT 24 +#define TCHORIZPOS 24 +#define TC_COUNT 25 #define tccan(X) (tclen[X]) -- Tatsuo Furukawa (frkwtto@osk3.3web.ne.jp)