bool
 StreamReaderUnix::ReadInput(size_t& nRead, InputData& in) {
   int c = ReadRawCharacter();
   in.SetModifier(InputData::kModNone);
   if (c == -1) {
     in.SetExtended(InputData::kEIEOF);
   } else if (c == 0x1b) {
     // Only try to process CSI if Esc does not have a meaning
     // by itself.
     if (GetContext()->GetKeyBinding()->IsEscCommandEnabled()
         || !ProcessCSI(in)) {
       in.SetExtended(InputData::kEIEsc);
     }
   } else if (isprint(c)) {
     in.SetRaw(c);
   } else if (c < 32 || c == (char)127 /* ^?, DEL on MacOS */) {
     if (c == 13) {
       in.SetExtended(InputData::kEIEnter);
     } else {
       in.SetRaw(c);
       in.SetModifier(InputData::kModCtrl);
     }
   } else {
     // woohoo, what's that?!
     in.SetRaw(c);
   }
   ++nRead;
   return true;
 }
Esempio n. 2
0
void
StreamReaderWin::HandleKeyEvent(unsigned char C, InputData& in) {
    if (isprint(C)) {
        in.SetRaw(C);
    } else if (C < 32) {
        in.SetRaw(C);
        in.SetModifier(InputData::kModCtrl);
    } else {
        // woohoo, what's that?!
        in.SetRaw(C);
    }
}