Brett Terpstra's "BulletList" extension deletes lines in Obsidian

Apologies if this is too much of an edge-case: I use the heck out of all of Brett Terpstra’s PopClip Extensions, especially the BulletList extension. But recently, it’s been malfunctioning in Obsidian: instead of converting multiple lines of text into a bulleted list, it generates a single paragraph, eliminating all the line breaks. Works fine in other apps.

In addition: if you hold down the ⌥ key, you get a numbered list, but this also doesn’t replace it in place. I suppose this is for Brett Terpstra to fix, but he’s already done so much for the community….

1 Like

I’m unable to reproduce the fault in Obsidian, can you give more detailed instructions or a video perhaps?

Regarding the Option key, that one’s a mea culpa. I added a feature in PopClip such that when holding the ⌥ key when clicking an extension, it will display the result in the PopClip bar instead of the default action (such as pasting it).

However, you can disable this with the following Terminal command:

defaults write com.pilotmoon.popclip DisableAlternateActions -bool YES

then Quit and restart PopClip.

2 Likes

Hi Nick,

Thanks for following up. I’ve done a fresh install of Brett’s popclip, and tried with with the plugins all turned off. Still not working.

Here’s what Brett wrote to me:

I’ve never examined it, but I’m going to assume Obsidian is electron-based and has its own text management. Same type of issue in VS Code, which is a major reason I don’t use it: none of my services and extensions that I rely on work properly with it. Not sure there’s any solution for obsidian, but if someone does have one, I’d be very interested in it.

Thanks,

Brett

CleanShot 2022-11-17 at 13.14.16

2 Likes

Thanks for the video and more details.

Weirdly, when I test it on my Mac, it works fine (see vid below). I wonder what could be different in our setups? I’m on macOS 12.5 with Obsidian 1.0.3.
CleanShot 2022-11-18 at 10.13.11

That said, can you try entering the following command in Terminal:

defaults write com.pilotmoon.popclip DeepCapture -bool YES

then Quit and restart PopClip. Does it change the behaviour?

1 Like

Hi again – so I’ve now been able to reproduce the fault in Obsidian. (Didn’t do anything, it just started doing it…)

It’s a fault in the Chromium web view that it uses – the same bug affects Chrome itself. Basically, it doesn’t report newline characters in the AXSelectedText accessibility attribute. Hence why the extension only adds one bullet point.

However, I’ve come up with a cunning idea to get around it by reading a different value (AXValue) that does have newlines in and then walking the string skipping over newlines to match the faulty range value (from AXSelectedTextRange)… anyway suffice to say I hope to get something good working soon. I’ll keep you posted.

2 Likes

You’re amazing. Thanks, Nick! Look forward to seeing the fix.

1 Like

Beta 4093 has the fix. At least, my first attempt at it. If you get a chance to try it, please let me know how you get on.
EDIT: I jumped the gun, I had to remove the beta temporarily because of a gatekeeper problem. Should be back soon … EDIT2: Back up now

Works a charm – for me at least. Thanks so much!

I’ve tested it on:

  1. “Markdown to Rich Text Format” (this turns out to be the most useful for me, allowing me to easily paste formatted text from Markdown into an email). Discussed here: Idea: Markdown to RTF - #11 by nick. Now that this is stable, it really should be featured under “Markdown” at PopClip Extensions.
  2. Bullet list (from Brett Terpstra) - works smoothly!
  3. Numbered list (using modifier key on “Bullet List” – works, but is still a bit janky, since it adds an additional pop-up that needs to be accepted with “Enter”) - not a problem, though.

I would add that during the period when this wasn’t working, I discovered that Obsidian now includes the ability to reformat selected text as Bullet List or Numbered List via the menubar: Insert > Bulleted List.

Awesome, thanks for the feedback. I quite agree it’s time to release the extension - it was on my to-do list all last week.

The extra popup with the paste preview happens by virtue of Option being held down. I need to come up with a better solution for extensions that have alternate modes like this. For now, you can disable this (for all extensions) by the following Terminal command:

defaults write com.pilotmoon.popclip DisableAlternateActions -bool YES

then Quit and restart PopClip.

Of course, in the new SetApp version, that needs to be:
defaults write com.pilotmoon.popclip-setapp DisableAlternateActions -bool YES

1 Like

Just adding a note here to say that this has changed as of PopClip 2024.3. Prefs commands for Setapp edition are now the same as for Stanalone edition. The prefs identifier is com.pilotmoon.popclipfor both.