diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-05-19 13:10:41 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-05-19 13:10:41 +0000 |
commit | 4fec788fa5f6e7c9723e02e3d0b57068ce9785aa (patch) | |
tree | 2b4fd7f79ee29b231c77c9bc0bc67b4eed913bef /Src/Zle/zle_refresh.c | |
parent | ea0ddb0fc6073be3d7d289e59b083f564dbd761f (diff) | |
download | zsh-4fec788fa5f6e7c9723e02e3d0b57068ce9785aa.tar.gz zsh-4fec788fa5f6e7c9723e02e3d0b57068ce9785aa.tar.xz zsh-4fec788fa5f6e7c9723e02e3d0b57068ce9785aa.zip |
zsh-3.1.5-pws-19 dot-zsh-3.1.5-pws-19-199905271502
Diffstat (limited to 'Src/Zle/zle_refresh.c')
-rw-r--r-- | Src/Zle/zle_refresh.c | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c index 2377b70fa..9742ba501 100644 --- a/Src/Zle/zle_refresh.c +++ b/Src/Zle/zle_refresh.c @@ -881,20 +881,8 @@ moveto(int ln, int cl) } } - 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 @@ tcmultout(int cap, int multcap, int ct) 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 @@ tc_rightcurs(int cl) 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 @@ singmoveto(int pos) { 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; } |