Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: right cursor movement patch (for zsh-3.1.5-pws-18)
- X-seq: zsh-workers 6274
- From: Tatsuo Furukawa <frkwtto@xxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: right cursor movement patch (for zsh-3.1.5-pws-18)
- Date: Thu, 13 May 1999 00:49:09 +0900
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
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@xxxxxxxxxxxxxxx)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author