When copying folded content, <!-- {"fold":true} --> appears in the copied text

Testing version:
MacOS Version 2.0.3 (11772)

What were you doing:
Copying some folded content with Command-C

What feature did you use:
Folding + Copy

What happened:
I copied the following markdown, only it was folded:


Spanish Pronouns

Yo — I
tú (informal) — you

And when I pasted the copy, I got:


Spanish Pronouns

Yo — I
tú (informal) — you

What did you expect to happen:
It shouldn’t matter if the content is folded or not, I should get the same copied text.

Let’s try again! I didn’t realize my text was going to be interpreted as markdown itself!

So, when I copy the following, collapsed:

# Spanish Pronouns

Yo — I
tú (informal) — you

I get the following:

# Spanish Pronouns<!-- {"fold":true} -->

Yo — I
tú (informal) — you

It happens with collapsed Headings and collapsed bullets.

Hello,
Can you please confirm you can replicate the issue with version 2.0.5?

Yes, in MacOS Bear, v2.0.5, I can reproduce it. I just tried it. Note, I’m pasting into VisualStudio Code. You can also reproduce it by selecting “Paste and Match Style” in other apps. I just noticed if I paste it here. in Gmail, with normal paste, it appears correct. If I select “copy-as-plain-text” or “copy-as-markdown” it is wrong. If I select “copy-as-rich-text” or “copy-as-html” it is right.

Example:

Outline:

  • Concurrency Slide
  • Make sure your DB scales out
  • Make sure any EC2 load scales out
1 Like

After some thinking, I realized this is a little controversial. In your case, the expectations are correct but what you got is the effective plain text underneath the Bear representation. In other words, we can remove the folding metadata but I don’t know if this is what everybody will expect on copy.

1 Like

Hmm. I’m not sure how that would be controversial. It seems to me “if I didn’t type it, it shouldn’t copy it” is a very reasonable expectation. I didn’t know, nor care, that the way Bear represents code folding is by inserting metadata directly in the raw text.

2 Likes

They say you shouldn’t draw conclusions about others from yourself. But if I were to do that, I would not only agree with the quoted argument, but would also assume that everyone else can only have the same expectation.

3 Likes