Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Patch available for 3.0.6-pre-0



Hello, Bart,  Thank you for quick response.

Bart> There are other programs than zsh that would be confused by this
Bart> behavior.

Yes.  (But I didn't know yesterday.)  According "termcap & terminfo"
book, UNIX assumes that tab stop are assigned to 8, 16, 24, 32, ....
So, I don't have to think that TAB stop is valiable.

Bart> Am I wrong in thinking the fix for this is `stty -tabs` ?  

I tried it.  And this works completely well!  So, `stty -tabs` are
good solution.  But it is not a perfect solution for perfomance.


Bart> but as a frequent ssh-over-28.8-PPP-link user, I'm sensitive to
Bart> issues with speed of screen refresh and I'd rather not be
Bart> needlessly penalized.

I think that most of users is NOT affected by this patch.  Because
NORMAL terminal has RI= entry.  If the terminal has RI= entry, zsh
will use it.  If it doesn't, zsh will use another method (TAB will be
used).  So, maybe, I think you will not affect any more.

But, I am begining to think that it is not interesting to apply
degrade patch.  So, I wrote a new patch. :-)


Hpterm does not have RI= entry. (RI is relative horizontal cursor
move).  But hpterm has ch= entry.  (ch is absolute horizontal cursor
move).  I added the code that zsh supports 'ch=' entry.

And I found that zle_refresh.c has two similar function.
(tc_rightcurs() and singmoveto()).  I modified tc_rightcurs().
tc_rightcurs() is originally absolute cursor move.  Now,
tc_rightcurs() is relative cursor move.  Because tc_leftcurs() is
relative, they are a couple now.  (If you want to move absolutely, use
 singmoveto()).


Here is the patch:

diff -ur zsh-3.0.6-pre0/Src/globals.h zsh-3.0.6-pre0-new/Src/globals.h
--- zsh-3.0.6-pre0/Src/globals.h	Wed Apr 21 18:53:47 1999
+++ zsh-3.0.6-pre0-new/Src/globals.h	Thu Apr 22 10:57:01 1999
@@ -614,7 +614,7 @@
 {
     "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"
 };
 #else
 extern char *tccapnams[TC_COUNT];
diff -ur zsh-3.0.6-pre0/Src/zle_refresh.c zsh-3.0.6-pre0-new/Src/zle_refresh.c
--- zsh-3.0.6-pre0/Src/zle_refresh.c	Fri Sep 26 10:42:19 1997
+++ zsh-3.0.6-pre0-new/Src/zle_refresh.c	Thu Apr 22 20:47:04 1999
@@ -808,20 +808,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);
 }
 
 /**/
@@ -841,14 +829,16 @@
 
 /**/
 void
-tc_rightcurs(int cl)
+tc_rightcurs(int ct)
 {
-    int ct,			/* number of characters to move across	    */
-	i = vcs,		/* cursor position after initial movements  */
+/* ct: number of characters to move across      */
+/*     cursor position after initial movements  */
+    int cl,			
+	i = vcs,		
 	j;
     char *t;
 
-    ct = cl - vcs;
+    cl = ct + vcs;
 
 /* do a multright if we can - it's the most reliable */
     if (tccan(TCMULTRIGHT)) {
@@ -1060,23 +1050,29 @@
 {
     if (pos == vcs)
 	return;
+
+/* do a horizontal position if we can */
+    if (tccan(TCHORIZPOS)) {
+	tcoutarg(TCHORIZPOS, pos);
+	vcs = pos;
+	return;
+    }
+
+
+/* choose cheapest movements for ttys without multiple movement capabilities -
+   do this now because it's easier (to code) */
+
     if (pos <= vcs / 2) {
 	zputc('\r', shout);
 	vcs = 0;
     }
-    if (pos < vcs) {
-	tc_leftcurs(vcs - pos);
+
+    if (pos < vcs)
+       tc_leftcurs(vcs - pos);
+    else if (pos > vcs)
+       tc_rightcurs(pos - vcs);
+
 	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 */
diff -ur zsh-3.0.6-pre0/Src/zsh.h zsh-3.0.6-pre0-new/Src/zsh.h
--- zsh-3.0.6-pre0/Src/zsh.h	Wed Apr 21 18:53:49 1999
+++ zsh-3.0.6-pre0-new/Src/zsh.h	Thu Apr 22 11:07:22 1999
@@ -1249,7 +1249,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@xxxxxxxxxxxxxxx)



Messages sorted by: Reverse Date, Date, Thread, Author