Console Windows keyboard event handler in Cygwin

Andy Chow andrew_show@hotmail.com
Sun Apr 4 10:07:00 GMT 2004


I have use cygwin for several years, one thing related with keyboard input in console window of cygwin bash shell is annoying, I prefer to use Cygwin+emacs in console window, but it seems some key sequece doesn't work well in emacs, such as Ctrl-space, backspace, Ctrl-H. Some people suggested to use emacs in X to avoid the problem, And some command in emacs (like normal-erase-is-backspace-mode) will make things more complex.

Finally I try to resolve the problem by myself.

Some one has said that Windows dosn't generate Ctrl-space key code (0x00), that's right, but it should be cygwin responsibility to translate Windows keyboard event to unix like key code. 
Inside Cygwin DLL, the fhandler_console::read function is responsible to convert Windows console input to unix like key code, the WIN32 API ReadConsoleInput is used to read console input event. When ReadConsoleInput get a keyboard, it should check if the virtual key is VK_SPACE, if it is, it should check the control_key_state and if control key is pressed, it should translate the VK_SPACE to the key code 0x00.

For backspace key, Windows always translate it to 0x08, which is same as Ctrl-H, I modify the fhandler_console::read to translate it to 0x7F(DEL) so it will not conflict with Ctrl-H in emacs.

I don't sure it will cause another problem, but I use this method to fix some annoying problem in emacs.

Thanks

Andy Chow  

 


   
    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cygwin.com/pipermail/cygwin-developers/attachments/20040404/1b8c0972/attachment.htm>


More information about the Cygwin-developers mailing list