termRawMode (Function)

Signature: termRawMode(enabled: int) -> Unit

Description: Enables (1) or disables (0) raw terminal input mode, so keypresses arrive unbuffered.

Parameters

  • enabled (int): 1 to enable raw mode, 0 to restore cooked mode

Returns: Unit

Example

// Run in an interactive terminal; raw mode is restored before printing.
termRawMode(1)
let key = termReadKey()
termRawMode(0)
print(key)
// Run in an interactive terminal; raw mode is restored before printing.
termRawMode 1
key = termReadKey ()
termRawMode 0
print key