zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: fix menu completion on terminal with do=^J/without do
@ 2003-04-27  8:49 Andrey Borzenkov
  2003-04-27 10:27 ` Geoff Wing
  2003-04-30 15:55 ` Wayne Davison
  0 siblings, 2 replies; 3+ messages in thread
From: Andrey Borzenkov @ 2003-04-27  8:49 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 592 bytes --]

Standard termcap for Linux console defines "do" (down_cursor) as ^J.  Zsh 
init_term ignores it in this case (Geoff, could you enlighten why it does 
it?); it then provides workaround in zle_refresh by actually using ^J but 
moving cursor to needed column then.

Unfortunately complist is using termcap directly and thus outputs no 
down_cursor at all but believes it has moved to correct line.

The patch exports tc_downcurs and makes complist using it. I refrain from 
removing ^J code in init_term not knowing reasons or possible implications.

If it is OK I commit it tomorrow.

-andrey


[-- Attachment #2: zsh_tcdown.patch --]
[-- Type: text/x-diff, Size: 1192 bytes --]

--- Src/Zle/complist.c.tcdown	2002-10-15 22:00:02.000000000 +0400
+++ Src/Zle/complist.c	2003-04-27 11:22:26.000000000 +0400
@@ -1556,7 +1556,7 @@ singledraw()
     mcc2 = singlecalc(&mc2, ml2, &lc2);
 
     if (md1)
-        tcmultout(TCDOWN, TCMULTDOWN, md1);
+        tc_downcurs(md1);
     if (mc1)
         tcmultout(TCRIGHT, TCMULTRIGHT, mc1);
     g = mgtab[ml1 * columns + mc1];
@@ -1565,7 +1565,7 @@ singledraw()
     putc('\r', shout);
 
     if (md2 != md1)
-        tcmultout(TCDOWN, TCMULTDOWN, md2 - md1);
+        tc_downcurs(md2 - md1);
     if (mc2)
         tcmultout(TCRIGHT, TCMULTRIGHT, mc2);
     g = mgtab[ml2 * columns + mc2];
@@ -1576,7 +1576,7 @@ singledraw()
     if (mstatprinted) {
         int i = lines - md2 - nlnct;
 
-        tcmultout(TCDOWN, TCMULTDOWN, i - 1);
+        tc_downcurs(i - 1);
         compprintfmt(NULL, 0, 1, 1, mline, NULL);
         tcmultout(TCUP, TCMULTUP, lines - 1);
     } else
--- Src/Zle/zle_refresh.c.tcdown	2003-04-04 17:56:44.000000000 +0400
+++ Src/Zle/zle_refresh.c	2003-04-27 11:21:14.000000000 +0400
@@ -1062,7 +1062,7 @@ tc_rightcurs(int ct)
 }
 
 /**/
-static int
+mod_export int
 tc_downcurs(int ct)
 {
     int ret = 0;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: fix menu completion on terminal with do=^J/without do
  2003-04-27  8:49 PATCH: fix menu completion on terminal with do=^J/without do Andrey Borzenkov
@ 2003-04-27 10:27 ` Geoff Wing
  2003-04-30 15:55 ` Wayne Davison
  1 sibling, 0 replies; 3+ messages in thread
From: Geoff Wing @ 2003-04-27 10:27 UTC (permalink / raw)
  To: zsh-workers

Andrey Borzenkov <arvidjaar@mail.ru> typed:
: Standard termcap for Linux console defines "do" (down_cursor) as ^J.  Zsh 
: init_term ignores it in this case (Geoff, could you enlighten why it does 
: it?); it then provides workaround in zle_refresh by actually using ^J but 
: moving cursor to needed column then.

Limiting the vagaries arrising out of tty post-processing.  In this
case, someone could have their tty settings (see "stty") such that CTRL-J
maps to CTRL-M CTRL-J which would make the TERM/termcap entry incorrect.
BTW, it's existed since version 2.0

: Unfortunately complist is using termcap directly and thus outputs no 
: down_cursor at all but believes it has moved to correct line.
 
: The patch exports tc_downcurs and makes complist using it. I refrain from 
: removing ^J code in init_term not knowing reasons or possible implications.

I'll look at it tomorrow (since I have just come back from the pub now)

Regards,
-- 
Geoff Wing : <gcw@pobox.com>
Rxvt Stuff : <gcw@rxvt.org>
Zsh Stuff  : <gcw@zsh.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: fix menu completion on terminal with do=^J/without do
  2003-04-27  8:49 PATCH: fix menu completion on terminal with do=^J/without do Andrey Borzenkov
  2003-04-27 10:27 ` Geoff Wing
@ 2003-04-30 15:55 ` Wayne Davison
  1 sibling, 0 replies; 3+ messages in thread
From: Wayne Davison @ 2003-04-30 15:55 UTC (permalink / raw)
  To: Andrey Borzenkov; +Cc: zsh-workers

On Sun, Apr 27, 2003 at 12:49:49PM +0400, Andrey Borzenkov wrote:
> The patch exports tc_downcurs and makes complist using it.

Yes, this seems to be the right thing to do.  Because the init_term()
code may have completely disabled all known downward-motion capabilities
(when it removed "do=^J"), zsh must always call tc_downcurs(ct) instead
of trying to call tcmultout(TCDOWN, TCMULTDOWN, ct) directly.  It must
also be prepared to handle a non-zero return code which indicates that
the cursor has moved to column 0.

In the case of your patch, it appears that the calling code always
returns the cursor to column 0 before calling tc_downcurs(), so I
believe your patch to be the right fix.

..wayne..


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-04-30 15:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-27  8:49 PATCH: fix menu completion on terminal with do=^J/without do Andrey Borzenkov
2003-04-27 10:27 ` Geoff Wing
2003-04-30 15:55 ` Wayne Davison

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).