Sublime Forum

[ST3] Transpose words is broken

#1

in ST2, Transpose command works with words.
In ST3, it doesn’t works anymore because of the added parameter with a default value False:

def transpose_selections(edit, view, can_transpose_words = False):
0 Likes

Transpose (possibly again)
Dev Build 3048
#2

As I’ve had no answer if it’s by design or a bug, maybe it is not enough detailed.
With this line of code:

me.fireEvent('disable',this);

if I put my caret right before the “this” and hit “Transpose” keybinding results:
In ST2:

me.fireEvent(this,'disable');

In ST3:

me.fireEvent('disable't,his);

The ST2 behavior is very handy, the ST3 not too much.

startup, version: 3053 windows x64 channel: dev

0 Likes

#3

Yep, I can confirm this, too (Sublime Text 3, Build 3059)…

The Default Key Bindings in Windows offer no guidance either. Maybe a Boolean option there would be a good idea…

0 Likes

#4

[quote=“Asotos”]Yep, I can confirm this, too (Sublime Text 3, Build 3059)…

The Default Key Bindings in Windows offer no guidance either. Maybe a Boolean option there would be a good idea…[/quote]

Don’t expect any fix soon, this bug report (and all others I’ve reported) was totally ignored.

Fortunately, you can fix it yourself by copying the file “transpose.py” from the Default package (this is for Windows, it’s a zip file):

C:\Program Files\Sublime Text 3\Packages\Default.sublime-package

to your user folder:

\Packages\User\transpose.py

and change the default value of “can_transpose_words” argument to True:

def transpose_selections(edit, view, can_transpose_words = True):

The drawback is that you override the standard source file and you have to check when ST is updated if this source is modified.

1 Like

#5

A better workaround is to create a transpose_fix.py in your User directory containing:

import Default.transpose

# Change the default value for can_transpose_words argument to be the same as ST2
Default.transpose.transpose_selections.__defaults__ = (True,)

When (If?) this issue is resolved, you just have to delete this file.

2 Likes

#6

Why don’t you just modify the key binding? Does it not forward the parameter? (can’t check myself right now)

0 Likes

#7

No, but it’s probably the best way to solve this issue.

0 Likes