duydao / Text-Pastry

Extend the power of multiple selections in Sublime Text. Modify selections, insert numeric sequences, incremental numbers, generate uuids, date ranges, insert continuously from a word list and more.
MIT License
830 stars 46 forks source link

Some presets don't work #51

Closed HamzaLee closed 8 years ago

HamzaLee commented 8 years ago

Hi, I'm using Text-Pastry 1.4.10 with ST2, I'm trying to use presets,

I writeletters a-c, the result is

letters a-c

, like it does not recognize the preset

same for greek Alpha-Beta

When I write months, I get

08/12/16

I tried simple selection and multi selection, the result is the same.

duydao commented 8 years ago

Hey mate,

thanks for using Text Pastry!

Interesting bug. I couldn't reproduce it right away, could you check the console (View -> Show Console) and check the Text Pastry settings file content?

HamzaLee commented 8 years ago

Hi, this is what the console shows when I use letters a-c :

('remaining commands found:', '\x00 t \x00 t \x00 e \x00 r \x00 s \x00 \x00 a \x00 \x00 c \x00') reloading /C/Users/**/AppData/Roaming/Sublime Text 2/Packages/User/TextPastryHistory.sublime-settings

and this is User\TextPastry.sublime-settings

{ "presets": { "weekdays": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], "months": ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], "letters": ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"], "greek": ["Alpha", "Beta", "Gamma", "Delta", "Epsilon", "Zeta", "Eta", "Theta", "Iota", "Kappa", "Lambda", "Mu", "Nu", "Xi", "Omicron", "Pi", "Rho", "Sigma", "Tau", "Upsilon", "Phi", "Chi", "Psi", "Omega"] } }

I opened TextPastryCommands.json and I could not find anything like "letters" or "greed", I don't know, but maybe it helps you the resolve the bug.

duydao commented 8 years ago

I've checked the plugin in ST2 and I found the bug. It seems to relate to the shlex that is used for splitting the command if it's a preset.

See line Line 1275

You can change the line to this in your Sublime Text 2/Packages/Text Pastry/text_pastry.py to make it work:

for arg in s.split():

The fix will be in the next release.

Thanks for reporting this & thanks alot for using Text Pastry!