This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: remapping Cygwin 'bash' readline functions to PC keys


Cavaet for non-cygwin users: Keep in mind that the C-V 
will only work with ANSI escape sequences (which 
Cygwin produces in its "command line" windows. C-V will 
not work for all terminals (or their emulators) - 
especially VT52, Hazeltine, ...

Most MS-Windows users can ignore the above warning.

--Bruce
PS: 'od -c' merely outputs the "character" equivalents 
of its input. So, pressing the Home key, followed by C-d
(control-d) after entering the 'od -c' command will result
in something like: 

0000000 033   [   1   ~  \n

Telling you that "Escape" (033) "[" "1" "~" "newline" 
was entered. But you probably already knew that.

Quoting "Lee D. Rothstein" <lee at veritech dot com>:
> John, thanks for the <C-V> heads up! Others had
> suggested, variations of 'cat < foo' and 'od -c'. (The
> former I got to work, the latter remains a mystery.)
> Your solution, besides being the most straight-forward,
> is also a great tool to have around. Apparently, it's a
> feature of Cygwin, or 'bash', since it doesn't work in
> a naked 'cmd.exe' window. I'll be sure to add it to my
> documentation.
> 
> Unfortunately the key combos I'm trying to map to
> are: <^-->> and <^-<-> (control- and the right and left
> arrow keys). It turns out that the character string
> outputs for both the:
> 
> * naked key
> * shift - and the naked key
> * control- and the naked key
> 
> are all the same.
> 
> Actually, I no longer consider these to be KIDs; these
> are the character string graphemic outputs of hitting
> the key. I'll continue to reserve "KIDs" for when one
> represents these [and the key isomorphisms]
> with '/e...', 'C-...', etc. "notation".
> 
> Apparently (?), the only way to discriminate among these
> three alternatives is with Scan Codes. Apparently, all
> the -x-ish stuff I've used (Microemacs, Thompson shell
> command line editing) that can discriminate among the
> three alternatives all use Scan Codes (?).
> 
>   - Any way to map to Scan Codes to 'bash' 'readline'
>     functions under Cygwin?
>     + Or to key "names" like: '<CTRL-left-arrow>',
>       '<CTRL-HOME>'
>   - Any interest among Cygwin developers in adding
>     this?
> 
>  >At 2003-02-19 08:02 AM -0800, John Mapole wrote:
> ...
>  >You can build your own KID table. Once at the cygwin
>  >prompt you can type <C-V>, that's control-V, followed
>  >by the key.  On my machine, if I type <C-V><INSERT>, I
>  >see "^[[2~".  This is the same as "\e[2~".
>  >
>  >Why these mapping are like this relates to how windows
>  >maps them and then how cygwin maps them.  Something I
>  >am now very clear on.
>  >
>  >Hope this helps some.
>  >
>  >John Mapoles
>  >
>  >--- "Lee D. Rothstein" <lee at veritech dot com> wrote:
> ...
>  >> Q1 -- When you remap a 'bash' Edit Mode function in
>  >> .inputrc, it looks like this:
>  >>
>  >> "\e[3~":      delete-char # DEL key
>  >>
>  >> The entity in double quotes ("\e[3~"), I'm calling
>  >> the "key ID (KID)". In the above '.inputrc' declaration,
>  >> the function 'delete-char' being remapped from its
>  >> default key assignment to the KID -- "\e[3~" -- the
>  >> <DEL> key.
>  >>
>  >> What are the KIDs of the following IBM PC keys
>  >> (specified below with facsimiles of the key caps
>  >> contained in angle brackets -- '<...>')?
>  >>
>  >> Cursor control key pad
>  >> ----------------------
>  >> <HOME>
>  >> <END>
>  >> <left-arrow>
>  >> <right-arrow>
>  >> <PAGE_UP>
>  >> <PAGE_DOWN>
>  >> <INSERT>
>  >>
>  >> Numeric pad
>  >> -----------
>  >> <->
>  >> <+>
>  >> <ENTER>
>  >> </>
> 
> I should have included in the above lists, all variations
> of the above with the control, alt and shift keys.
> 
>  >> In general, I'd like a table that maps the KIDs for all
>  >> 104 keys on the keyboard I use. Or, better still, is
>  >> there a way to use scan codes?
>  >>
>  >> (Incidentally, what makes finding a table of these
>  >> KIDs so difficult is the failure of the documentation
>  >> to assign this concept a unique, or even a consistent
>  >> word.)
>  >>
>  >> Q2
>  >> --
>  >>
>  >> Is there a way to make the <INSERT> key a toggle
>  >> between the insert and overwrite modes of 'bash'
>  >> edit mode?
>  >>
>  >> I used to have these figured out for 'Microemacs',
>  >> but that was half a lifetime ago, for me, & Microemacs
>  >> supported scan codes, if I remember correctly.
> 
> --
> Lee D. Rothstein -- lee at veritech dot com
> VeriTech -- 603-424-2900
> 7 Merry Meeting Drive
> Merrimack, NH 03054-2934  
> 


-------------------------------------------------
This mail sent through IMP: www.milessmithfarm.net

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]