This is the mail archive of the cygwin-developers@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]

Console Windows keyboard event handler in Cygwin


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  
 
 
 
 
   
    

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