Logo Search packages:      
Sourcecode: yydebug version File versions  Download package

void jay::yydebug::yyJInputStream::doKey ( JTextArea  ta,
char  ch,
boolean  paste 
) [inline, protected]

process one typed or pasted character. The caret position is not updated for pasting.

Definition at line 150 of file yyJInputStream.java.

References line, and queue.

Referenced by keyPressed().

                                                              {
    switch (ch) {
    case '\n': case '\r':           // \n|\r -> \n, release line
      line.append('\n');
      if (paste) ta.append("\n");
      break;

    case 'D'&31:              // ^D: release line
      ta.append("^D\n"); ta.setCaretPosition(ta.getText().length());
      break;

    case '\b':                // \b: erase char, if any
      int len = line.length();
      if (len > 0) line.setLength(len-1);
      if (paste) ta.append("\b");
      return;

    case 'U'&31:              // ^U: erase line, if any
      line.setLength(0);
      ta.append("^U\n"); ta.setCaretPosition(ta.getText().length());
      // fall through
    case 'C'&31:              // ^C: ignore (used as copy key)
    case 'V'&31:              // ^V: ignore (used as paste key)
      return;

    default:
      line.append(ch);
      if (paste) ta.append(""+ch);
      return;
    }
    synchronized (this) {
      queue.add(line.toString().getBytes());
      notifyAll(); // there could be several reading threads 
    }
    line.setLength(0);
  }


Generated by  Doxygen 1.6.0   Back to index