Home Download Buy Blog Forum Support

Transpose is broken

Transpose is broken

Postby cwolves on Tue Oct 09, 2012 12:01 am

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:

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


CTRL+T yields:

Code: Select all
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.
cwolves
 
Posts: 12
Joined: Thu Jan 12, 2012 9:01 pm

Re: Transpose is broken

Postby nick. on Tue Oct 09, 2012 2:07 pm

From Packages/Default/transpose.py:
Code: Select all
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
    """


I think the space in "attribute s" is causing the algorithm to behave unexpectedly.
nick.
 
Posts: 266
Joined: Wed Jan 18, 2012 3:45 am


Return to Technical Support

Who is online

Users browsing this forum: fstafforini and 16 guests