Skip to content
Snippets Groups Projects
  • Rob Swindell's avatar
    18bbb277
    Optionally distinguish between timeout and NUL inkey() result · 18bbb277
    Rob Swindell authored
    Some terminals can send NUL (ASCII 0), e.g. hitting Ctrl-Space in Apple iTerm. Allow users of inkey() (in C++ or JS) to optionally detect the difference by specifying the K_NUL mode flag. In JS, console.inkey() will return null upon timeout (rather than "") when the K_NUL mode flag is used and return an empty string ("") upon receipt of NUL (ASCII 0).
    
    The default is the previous behavior where a timeout and the receipt of a NUL character appear the same to the caller of inkey().
    18bbb277
    History
    Optionally distinguish between timeout and NUL inkey() result
    Rob Swindell authored
    Some terminals can send NUL (ASCII 0), e.g. hitting Ctrl-Space in Apple iTerm. Allow users of inkey() (in C++ or JS) to optionally detect the difference by specifying the K_NUL mode flag. In JS, console.inkey() will return null upon timeout (rather than "") when the K_NUL mode flag is used and return an empty string ("") upon receipt of NUL (ASCII 0).
    
    The default is the previous behavior where a timeout and the receipt of a NUL character appear the same to the caller of inkey().