public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Shift-Tab for Backwards Completion
@ 2008-06-17 20:34 Frank Jacobs
  2008-06-18 20:59 ` Thorsten Kampe
  2008-06-18 22:03 ` Thorsten Kampe
  0 siblings, 2 replies; 6+ messages in thread
From: Frank Jacobs @ 2008-06-17 20:34 UTC (permalink / raw)
  To: cygwin

I've used the solution below so that I can go back in the completion
list in Bash via the SHIFT-TAB keystroke. However, I can only get it
to work when running in an xterm window (where $TERM=xterm). It
doesn't work in the plain-ol' Windows console window (where
$TERM=cygwin).

The research that I've done has pointed me to termcap as a possible
suspect. Grokking termcap is going to take me a while. Before I go
down a possible dead end, does anyone have any comments on why
SHIFT-TAB doesn't work when running Cygwin/Bash in a Windows console
window? (By "doesn't work" I mean that SHIFT-TAB behaves the same as
pressing TAB by itself).

Here's the aforementioned solution for configuring SHIFT-TAB for
backwards completion:

http://klo-2k.spaces.live.com/blog/cns!2872308BEB65CA67!521.entry

Thanks,

Frank

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Shift-Tab for Backwards Completion
  2008-06-17 20:34 Shift-Tab for Backwards Completion Frank Jacobs
@ 2008-06-18 20:59 ` Thorsten Kampe
  2008-06-18 22:03 ` Thorsten Kampe
  1 sibling, 0 replies; 6+ messages in thread
From: Thorsten Kampe @ 2008-06-18 20:59 UTC (permalink / raw)
  To: cygwin

* Frank Jacobs (Tue, 17 Jun 2008 14:49:18 -0500)
> I've used the solution below so that I can go back in the completion
> list in Bash via the SHIFT-TAB keystroke. However, I can only get it
> to work when running in an xterm window (where $TERM=xterm). It
> doesn't work in the plain-ol' Windows console window (where
> $TERM=cygwin).
> 
> The research that I've done has pointed me to termcap as a possible
> suspect. Grokking termcap is going to take me a while. Before I go
> down a possible dead end, does anyone have any comments on why
> SHIFT-TAB doesn't work when running Cygwin/Bash in a Windows console
> window? (By "doesn't work" I mean that SHIFT-TAB behaves the same as
> pressing TAB by itself).

Because Windows Console returns the same keycode for shifted/unshifted 
and for the Ctrl key. You can easily test that with [Ctrl][V] or "od -
c" (which are the standards tools to find out the key codes to be able 
to assign actions to them).

This is not restricted to the Windows console. Console[1] and the Linux 
console behave the same.

Thorsten
[1] http://console.sourceforge.net/


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Shift-Tab for Backwards Completion
  2008-06-17 20:34 Shift-Tab for Backwards Completion Frank Jacobs
  2008-06-18 20:59 ` Thorsten Kampe
@ 2008-06-18 22:03 ` Thorsten Kampe
  1 sibling, 0 replies; 6+ messages in thread
From: Thorsten Kampe @ 2008-06-18 22:03 UTC (permalink / raw)
  To: cygwin

* Frank Jacobs (Tue, 17 Jun 2008 14:49:18 -0500)
> I've used the solution below so that I can go back in the completion
> list in Bash via the SHIFT-TAB keystroke. However, I can only get it
> to work when running in an xterm window (where $TERM=xterm). It
> doesn't work in the plain-ol' Windows console window (where
> $TERM=cygwin).

...in addition to what I already said: in general you have to make 
assignments (action -> key) for every terminal you use (because the 
keycodes differ).


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Shift-Tab for Backwards Completion
  2008-06-20 12:12 ` Thorsten Kampe
@ 2008-06-20 16:49   ` Christopher Faylor
  0 siblings, 0 replies; 6+ messages in thread
From: Christopher Faylor @ 2008-06-20 16:49 UTC (permalink / raw)
  To: cygwin

On Fri, Jun 20, 2008 at 12:17:30PM +0200, Thorsten Kampe wrote:
>The question is why you do have different actions for those in Cmd 
>(which uses the same Windows terminal). Maybe because Cmd does not use 
>the same "keycode" mechanism as the Unix terminal/shells. But that's all 
>more or less guessing.

Yep.  I suspect that X decodes keypress events individually rather than
just using a normal Windows API interface like ReadFile.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Shift-Tab for Backwards Completion
  2008-06-19 15:13 Frank Jacobs
@ 2008-06-20 12:12 ` Thorsten Kampe
  2008-06-20 16:49   ` Christopher Faylor
  0 siblings, 1 reply; 6+ messages in thread
From: Thorsten Kampe @ 2008-06-20 12:12 UTC (permalink / raw)
  To: cygwin

* Frank Jacobs (Thu, 19 Jun 2008 09:51:00 -0500)
> > Because Windows Console returns the same keycode for shifted/
> > unshifted and for the Ctrl key. You can easily test that with
> > [Ctrl][V] or "od -c" (which are the standards tools to find out the
> >  key codes to be able to assign actions to them).
> 
> Thanks. Yeah, I do notice that "od -c" yields different results as you
> said. When running in an xterm, "od -c" returns different codes for
> TAB and SHIFT-TAB. As you said, the standard Windows console window
> returns the same key code for the two keystrokes in "od –c".
> 
> Am I correct that getting this working (in the standard Windows
> console) is not going to be possible? Is there anyway way with I could
> somehow define a key assignment where it looks to see whether the
> SHIFT key is pressed whenever a TAB keycode occurs?

The terminal generates the keycodes (at least that's what I think). So 
if the terminal generates the same keycodes for shifted and un-shifted 
keys there is no way for the standard tools (readline in bash, zle in 
zsh) to distinguish these and to assign differenct actions to them.

The question is why you do have different actions for those in Cmd 
(which uses the same Windows terminal). Maybe because Cmd does not use 
the same "keycode" mechanism as the Unix terminal/shells. But that's all 
more or less guessing.

Thorsten


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Shift-Tab for Backwards Completion
@ 2008-06-19 15:13 Frank Jacobs
  2008-06-20 12:12 ` Thorsten Kampe
  0 siblings, 1 reply; 6+ messages in thread
From: Frank Jacobs @ 2008-06-19 15:13 UTC (permalink / raw)
  To: cygwin

> Because Windows Console returns the same keycode for shifted/
> unshifted and for the Ctrl key. You can easily test that with
> [Ctrl][V] or "od -c" (which are the standards tools to find out the
>  key codes to be able to assign actions to them).

Thanks. Yeah, I do notice that "od -c" yields different results as you
said. When running in an xterm, "od -c" returns different codes for
TAB and SHIFT-TAB. As you said, the standard Windows console window
returns the same key code for the two keystrokes in "od –c".

Am I correct that getting this working (in the standard Windows
console) is not going to be possible? Is there anyway way with I could
somehow define a key assignment where it looks to see whether the
SHIFT key is pressed whenever a TAB keycode occurs?

Frank

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

end of thread, other threads:[~2008-06-20 14:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-17 20:34 Shift-Tab for Backwards Completion Frank Jacobs
2008-06-18 20:59 ` Thorsten Kampe
2008-06-18 22:03 ` Thorsten Kampe
2008-06-19 15:13 Frank Jacobs
2008-06-20 12:12 ` Thorsten Kampe
2008-06-20 16:49   ` Christopher Faylor

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 read-only IMAP folder(s) and NNTP newsgroup(s).