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
832 stars 46 forks source link

Text Pastry conflicts with PopClip #17

Closed bseymore closed 10 years ago

bseymore commented 10 years ago

Discovered a conflict between Text Pastry, the OS X utility app PopClip, and Sublime Text 3. When Text Pastry is installed, something keeps PopClip from appearing when text is selected with the mouse.

If you're not familiar with PopClip, it's allows you to do a number of great things with selected text. With Text Pastry disabled, using the mouse to highlight a string reveals a little toolbar. However, with Text Pastry enabled, the doesn't appear. A demo is available at the site above.

My setup is Sublime Text 3 (3062), PopClip 1.4.10, and Text Pastry 1.3.6 running on Mac OS X 10.9.4.

duydao commented 10 years ago

I've just installed the trial of PopClip (1.4.10) and it works fine on my Mac (10.9.3). May be an issue with 10.9.4

duydao commented 10 years ago

Just updated to 10.9.4, works for me aswell. Please re-confirm the bug

bseymore commented 10 years ago

Hmm. Thanks for looking into this!

It happens on both my iMac and on my MacBook Air. The PopClip bar only appears in SublimeText 3 when Text Pastry is in the Ignored Packages list. I've uninstalled and reinstalled Text Pastry (to make certain I'm using the latest release) and trimmed my Settings - User file to:

{
    "ignored_packages":
    [
        "Vintage"
    ],
}

I've also disabled apps like Moom, LaunchBar, and TextExpander and reduced PopClip to just a single task and no change. PopClip will only display in SublimeText if Text Pastry is ignored.

Is there anything at the command line level which might be of use? I'm running zsh instead of the bash shell and I may have upgraded PHP to 5.4.24, I can't remember.

bseymore commented 10 years ago

I fired up the Console and this is what appears when Text Pastry is enabled and I try to bring up the PopClip bar in Sublime Text. Nothing appears in the console when Text Pastry is enabled.

7/5/14 10:45:18.683 AM PopClip[2686]: [INFO] NMMenuItemFinder: (copy) counted 100
7/5/14 10:45:18.745 AM PopClip[2686]: [INFO] NMMenuItemFinder: (copy) counted 200
7/5/14 10:45:18.864 AM PopClip[2686]: [INFO] NMMenuItemFinder: (paste) counted 100
7/5/14 10:45:18.929 AM PopClip[2686]: [INFO] NMMenuItemFinder: (paste) counted 200
7/5/14 10:45:19.031 AM PopClip[2686]: [INFO] NMMenuItemFinder: (cut) counted 100
7/5/14 10:45:19.088 AM PopClip[2686]: [INFO] NMMenuItemFinder: (cut) counted 200

Those messages don't appear when bringing up the PopClip bar in other apps, like Mail or Chrome.

duydao commented 10 years ago

Could you send me your sublime packages directory as zip OR create a new mac user account with popclip, sublime text and package control/text pastry?

Am 05.07.2014 um 19:50 schrieb Brooks Seymore notifications@github.com:

I fired up the Console and this is what appears when Text Pastry is enabled and I try to bring up the PopClip bar in Sublime Text. Nothing appears in the console when it's enabled.

7/5/14 10:45:18.683 AM PopClip[2686]: [INFO] NMMenuItemFinder: (copy) counted 100 7/5/14 10:45:18.745 AM PopClip[2686]: [INFO] NMMenuItemFinder: (copy) counted 200 7/5/14 10:45:18.864 AM PopClip[2686]: [INFO] NMMenuItemFinder: (paste) counted 100 7/5/14 10:45:18.929 AM PopClip[2686]: [INFO] NMMenuItemFinder: (paste) counted 200 7/5/14 10:45:19.031 AM PopClip[2686]: [INFO] NMMenuItemFinder: (cut) counted 100 7/5/14 10:45:19.088 AM PopClip[2686]: [INFO] NMMenuItemFinder: (cut) counted 200 Those messages don't appear when bringing up the PopClip bar in other apps, like Mail or Chrome.

— Reply to this email directly or view it on GitHub.

bseymore commented 10 years ago

I installed Package Control and Text Pastry and PopClip a different user account but still running into the same issue: the PopClip bar will not display if Text Pastry is enabled.

More than happy to send my Packages directory. I assume you'll want that sent to the Gmail account listed on your Github page?

duydao commented 10 years ago

Yes, please! Meanwhile, I will setup a new account on my mac aswell. Maybee I can reproduce the problem this way

duydao commented 10 years ago

Thanks for the zip, I've been able to reproduce the problem and I'm happy to tell you that I have a workaround for it.

Somehow, PopClip seems to hook itself to "Special characters..." (you can see that "Edit" will flash up for a split second on the menu bar), and unfortunately, "Special characters..." uses the same key binding like the text pastry menu (CMD+ALT+T).

To work around this issue, you can follow this steps:

This will reassign the Special Chcaracters... menu item to CMD+ALT+SHIFT+Tand PopClip will work alongside with Text Pastry.

Of course you could use whatever shortcut you like, but it has to be a shortcut that isn't used by sublime text or any other Sublime Text plugins.

Please let me know if this works for you, thanks!

bseymore commented 10 years ago

Thanks! I've done this on both my MacBook Air (primary dev machine) and on my iMac (secondary dev machine) and while Edit > Special Characters… shows the CMD-ALT-SHIFT-T shortcut, PopClip only shows when Text Pastry is disabled.

To rule out conflicts with other packages, I completely uninstalled Sublime Text on my iMac to create a fresh install on that machine so, aside from Package Control and Text Pastry, that install is stock. I did this after finding another package which conflicted with the Text Pastry CMD-ALT-T key command, File History. Unfortunately, even on a fresh install, this doesn't solve the issue.

My current list of packages — after cleaning out a bunch of stuff I don't use — is now:

{
    "installed_packages":
    [
        "ApplySyntax",
        "AutoBackups",
        "BracketHighlighter",
        "CSScomb JS",
        "EasyDiff",
        "Emmet",
        "Predawn",
        "ReadmePlease",
        "SassBeautify",
        "SCSS",
        "SFTP",
        "SideBarEnhancements",
        "Text Pastry",
        "Theme - Soda"
    ]
}

I'll poke around a bit more after a little while to see if anything else on my setup could be the cause.

duydao commented 10 years ago

Could you please try the following steps:

[
    { "keys": ["super+alt+n"], "command": "text_pastry_show_command_line", "args": { "text": "" } },
    { "keys": ["super+alt+t"], "command": "text_pastry_show_menu" },
    { "keys": ["super+alt+b"], "command": "text_pastry_redo" }
]

FIY the following line was removed from the 1.3.6 settings file:

    { "keys": ["super+alt+v"], "command": "text_pastry_insert_text", "args": { "clipboard": true, "separator": "\\n" } },
bseymore commented 10 years ago

That works! By creating the Default (OSX).sublime-keymap file with those settings, the PopClip bar appears. Should this file have been created when I installed Text Pastry? And, will I need to recreate this file in the future if I ever reinstall Text Pastry, or will this be rolled into a bug fix release?

Not sure if I understand about the bit about the line having been removed from the 1.3.6 settings file. If I hadn't done a fresh install of Text Pastry, would that have been something I'd need to remove?

While I have you... is there a reason why insert_text_threshold is set to three words (?) by default? I discovered that a moment ago while composing a bit about another issue where trying to insert two words resulted in a No text found for Insert Text, cancelled error message; an inaccurate message since words were in the Text Pastry bar. I've overridden that value to two words in my TextPastry.sublime-settings file but by setting it lower, are there any potential issues I should be aware of?

Thanks for all your help on this!

duydao commented 10 years ago

By creating the file your installation will prioritize this file and ignore the one from the text pastry package. I will create a bugfix release for this bug (1.3.7).

duydao commented 10 years ago

insert_text_threshold was discussed here: https://github.com/duydao/Text-Pastry/issues/14

tl;dr: its safe to change the value to 2 :-)

Thanks for using Text Pastry!

duydao commented 10 years ago

I've created the bugfix release 1.3.7, it should be safe now to remove the created folder/file. Thanks!

bseymore commented 10 years ago

Upgraded Text Pastry on my iMac and the fix works there. Plus, cmd-option-t is now brings up the Text Pastry menu when rolling back (as a test) your earlier workaround.

Read the notes in issue #14 about insert_text_threshold. Thanks for pointing me to those.

pilotmoon commented 10 years ago

Looks like you have it figured out, but if there's anything you need from me I'm here. (Nick, PopClip dev.)

Just some info: PopClip looks through each app's menu for the menu items bound to the ⌘C, ⌘V and ⌘X shortcuts. It doesn't look for ⌘⌥T though, so I am a bit confused by that! I suspect it is a side effect of something else.

The messages "(copy) counted (200)" etc is PopClip warning that it looked at 200 menu items and still not found the ⌘C item. It would appear that somehow Text Pastry's menu items altered the menu structure in such a say PopClip could no longer find these items. I only speculate, though.

duydao commented 10 years ago

@invariant thanks alot for this insight! The problematic shortcut was ⌘⌥V, with your statement in mind: maybee PopClip is ignoring modifiers like Option or Shift when looking for these shortcuts.

I've removed the problematic shortcut from the package and added a note, users who still want to use it will be able to do so by simply adding it to the user keybindings file.

Thanks again for looking into this. BTW I'm starting to use PopClip and so far I'm very pleased :+1: