enableRawMode method

  1. @override
void enableRawMode()
override

Implementation

@override
void enableRawMode() {
  final origTermIOS = _origTermIOSPointer.ref;

  final newTermIOSPointer = calloc<TermIOS>()
    ..ref.c_iflag =
        origTermIOS.c_iflag & ~(brkint | icrnl | inpck | istrip | ixon)
    ..ref.c_oflag = origTermIOS.c_oflag & ~opost
    ..ref.c_cflag = (origTermIOS.c_cflag & ~csize) | cs8
    ..ref.c_lflag = origTermIOS.c_lflag & ~(echo | icanon | iexten | isig)
    ..ref.c_cc = origTermIOS.c_cc
    ..ref.c_cc[vmin] = 0 // VMIN -- return each byte, or 0 for timeout
    ..ref.c_cc[vtime] = 1 // VTIME -- 100ms timeout (unit is 1/10s)
    ..ref.c_ispeed = origTermIOS.c_ispeed
    ..ref.c_oflag = origTermIOS.c_ospeed;

  tcsetattr(stdinFileno, tcsanow, newTermIOSPointer);

  calloc.free(newTermIOSPointer);
}