# File lib/rbreadline.rb, line 4688
  def readline_internal_charloop()
    lastc = -1
    eof_found = false

    while (!@rl_done)
      lk = @_rl_last_command_was_kill

      #  send(rl_redisplay_function)
      #  @_rl_want_redisplay = false

      if (@rl_pending_input == 0)
        # Then initialize the argument and number of keys read.
        _rl_reset_argument()
        @rl_key_sequence_length = 0
      end

      rl_setstate(RL_STATE_READCMD)
      c = rl_read_key()
      rl_unsetstate(RL_STATE_READCMD)
      # look at input.c:rl_getc() for the circumstances under which this will
      #be returned; punt immediately on read error without converting it to
      #a newline.
      if (c == READERR)
        eof_found = true
        break
      end

      # EOF typed to a non-blank line is a <NL>.
      if (c == EOF && @rl_end!=0)
        c = NEWLINE
      end

      # The character _rl_eof_char typed to blank line, and not as the
      #previous character is interpreted as EOF.
      if (((c == @_rl_eof_char && lastc != c) || c == EOF) && @rl_end==0)
        eof_found = true
        break
      end
      lastc = c
      if _rl_dispatch(c, @_rl_keymap)== -1
        next
      end

      # If there was no change in _rl_last_command_was_kill, then no kill
      #has taken place.  Note that if input is pending we are reading
      #a prefix command, so nothing has changed yet.
      if (@rl_pending_input == 0 && lk == @_rl_last_command_was_kill)
        @_rl_last_command_was_kill = false
      end
      _rl_internal_char_cleanup()
    end

    eof_found
  end