# File lib/rbreadline.rb, line 4662
  def _rl_internal_char_cleanup()
    # In vi mode, when you exit insert mode, the cursor moves back
    #   over the previous character.  We explicitly check for that here.
    if (@rl_editing_mode == @vi_mode && @_rl_keymap == @vi_movement_keymap)
      rl_vi_check()
    end

    if (@rl_num_chars_to_read!=0 && @rl_end >= @rl_num_chars_to_read)
      send(@rl_redisplay_function)
      @_rl_want_redisplay = false
      rl_newline(1, "\n")
    end

    if (!@rl_done)
      send(@rl_redisplay_function)
      @_rl_want_redisplay = false
    end

    # If the application writer has told us to erase the entire line if
    #   the only character typed was something bound to rl_newline, do so.
    if (@rl_erase_empty_line && @rl_done && @rl_last_func == :rl_newline &&
        @rl_point == 0 && @rl_end == 0)
      _rl_erase_entire_line()
    end
  end