- empty selection, cursor within a word: transpose characters
- empty selection, cursor at the end of a word: transpose words
- multiple selections, all empty: as above
- multiple selections, at least one non-empty: rotate contents of selections
(i.e., each selection takes on the contents of the selection before it)
- single non-empty selection: do nothing
I think the space in "attribute s" is causing the algorithm to behave unexpectedly.