@Override
  protected int doReadInput( final CharSequence aChars )
  {
    if ( aChars == null )
    {
      throw new IllegalArgumentException( "Chars cannot be null!" );
    }

    int idx = getAbsoluteCursorIndex();

    for ( int i = 0; i < aChars.length(); i++ )
    {
      char c = aChars.charAt( i );

      switch ( c )
      {
        case '\010':
          // Backspace
          idx = removeChar( --idx, false /* aKeepProtectedCells */);
          break;

        case '\007':
          // Bell
          Toolkit.getDefaultToolkit().beep();
          break;

        case '\012':
          // Newline
          idx += getWidth();
          break;

        case '\015':
          // Carriage return
          idx -= ( idx % getWidth() );
          break;

        default:
          if ( !isRawMode() && ( c < ASCII_NAMES.length ) )
          {
            String name = ASCII_NAMES[c];
            for ( int j = 0; j < name.length(); j++ )
            {
              idx = writeChar( idx, name.charAt( j ) );
            }
          }
          else
          {
            idx = writeChar( idx, c );
          }
          break;
      }
    }

    updateCursorByAbsoluteIndex( idx );
    return aChars.length();
  }