Sublime Forum

Transpose is broken

#1

Transpose seems to like to swap entire words when your cursor is in the middle of whitespace. Whether or not this is correct is a different argument, but I know this is not correct:

for( n in attribute s| ){ <-- cursor is after the s // normal }

CTRL+T yields:

for( n in attribute normal ){ // s }

Is there a specific “transpose character” command? I almost never want to swap words. I generally only use transpose for typos so would like to re-map CTRL-T to always swap characters.

0 Likes

#2

From Packages/Default/transpose.py:

[code]class Transpose(sublime_plugin.TextCommand):
“”"
- 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
"""

[/code]

I think the space in “attribute s” is causing the algorithm to behave unexpectedly.

0 Likes