git.haldean.org e / master input.nim
master

Tree @master (Download .tar.gz)

input.nim @masterraw · history · blame

import illwill
import options

type
  Key* = distinct illwill.Key

proc toChar*(k: Key): Option[char] =
  let i = int(k)
  if i > 255 or i < 0:
    return none[char]()
  return some(i.char)

proc isEscape*(k: Key): bool =
  return illwill.Key(k) == illwill.Key.Escape

proc isBackspace*(k: Key): bool =
  return illwill.Key(k) == illwill.Key.Backspace

proc toIllwill*(k: Key): illwill.Key = illwill.Key(k)