# File lib/rbreadline.rb, line 8254
  def rl_transpose_words(count, key)
    orig_point = @rl_point

    return if (count==0)

    # Find the two words.
    rl_forward_word(count, key)
    w2_end = @rl_point
    rl_backward_word(1, key)
    w2_beg = @rl_point
    rl_backward_word(count, key)
    w1_beg = @rl_point
    rl_forward_word(1, key)
    w1_end = @rl_point

    # Do some check to make sure that there really are two words.
    if ((w1_beg == w2_beg) || (w2_beg < w1_end))
      rl_ding()
      @rl_point = orig_point
      return -1
    end

    # Get the text of the words.
    word1 = rl_copy_text(w1_beg, w1_end)
    word2 = rl_copy_text(w2_beg, w2_end)

    # We are about to do many insertions and deletions.  Remember them
    #   as one operation.
    rl_begin_undo_group()

    # Do the stuff at word2 first, so that we don't have to worry
    #   about word1 moving.
    @rl_point = w2_beg
    rl_delete_text(w2_beg, w2_end)
    rl_insert_text(word1)

    @rl_point = w1_beg
    rl_delete_text(w1_beg, w1_end)
    rl_insert_text(word2)

    # This is exactly correct since the text before this point has not
    #   changed in length.
    @rl_point = w2_end

    # I think that does it.
    rl_end_undo_group()
    word1 = nil
    word2 = nil

    0
  end