[GHC] #1198: Windows: hWaitForInput returns False for file handles, and doesn't work properly for consoles

GHC trac at galois.com
Fri Jun 20 14:16:56 EDT 2008


#1198: Windows: hWaitForInput returns False for file handles, and doesn't work
properly for consoles
-------------------------------------+--------------------------------------
 Reporter:  igloo                    |          Owner:         
     Type:  bug                      |         Status:  new    
 Priority:  low                      |      Milestone:  _|_    
Component:  libraries/base           |        Version:  6.6    
 Severity:  normal                   |     Resolution:         
 Keywords:                           |     Difficulty:  Unknown
 Testcase:  readwrite002, hReady001  |   Architecture:  Unknown
       Os:  Windows                  |  
-------------------------------------+--------------------------------------
Comment (by judah):

 Simon, assuming you're calling `ReadConsoleInput` to get the console
 event, I've found the following to work well.  An `INPUT_RECORD` named `e`
 corresponds to actual character input when these are all true:
  - {{{e.EventType == KEY_EVENT}}}
  - {{{e.KeyEvent.bKeyDown == TRUE}}}
  - {{{e.KeyEvent.uChar.AsciiChar != '\0'}}}

 The third condition filters out modifier keys like "shift".

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1198#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list