# File lib/rbreadline.rb, line 7912
  def rl_change_case(count, op)
    start = @rl_point
    rl_forward_word(count, 0)
    _end = @rl_point

    if (op != UpCase && op != DownCase && op != CapCase)
      rl_ding()
      return -1
    end

    if (count < 0)
      start,_end = _end,start
    end

    # We are going to modify some text, so let's prepare to undo it.
    rl_modifying(start, _end)

    inword = false
    while (start < _end)
      c = _rl_char_value(@rl_line_buffer, start)
      #  This assumes that the upper and lower case versions are the same width.
      if !@rl_byte_oriented
        _next = _rl_find_next_mbchar(@rl_line_buffer, start, 1, MB_FIND_NONZERO)
      else
        _next = start + 1
      end

      if (!_rl_walphabetic(c))
        inword = false
        start = _next
        next
      end

      if (op == CapCase)
        nop = inword ? DownCase : UpCase
        inword = true
      else
        nop = op
      end
      if (isascii(c))
        nc = (nop == UpCase) ? c.upcase : c.downcase
        @rl_line_buffer[start] = nc
      end

      start = _next
    end

    @rl_point = _end
    0
  end