Bug Report: Drafts Mac 44.2.1 Loses Formatting When Pasting Text Containing Tabs

Issue Summary

When pasting text containing tabs into Drafts Mac 44.2.1, the formatting is lost.

Steps to Reproduce

  1. Copy text that uses tabs for indentation (e.g., from VSCode).
  2. Paste the text into Drafts Mac 44.2.1.

Expected Result

The text should maintain its original formatting with tabs.

Actual Result

The formatting is lost, and the text appears unindented.

Additional Information

  • Figure 1: Code in VSCode using tabs for indentation.
  • Figure 2: Result after pasting into Drafts, showing lost formatting.
  • Figure 3: My editor settings.

Note: When the copied text uses spaces for indentation, the formatting is preserved correctly.

Images: https://imgur.com/a/muyybTW

Try SHIFT+CMD+V to paste as plain text or pasting the same indented text from another app.

VS code probably isn’t quite putting what you think it is (/should) on the clipboard.

I have to paste as text when using VS Code on Mac and Windows for this reason. I’m always getting dropped indentation and additional line breaks otherwise.

e.g. if I have this code in VS Code:

// create a function named greet()
function greet() {
	console.log("Hello World!");
}

If I paste into Drafts, I get this

// create a function named greet()

function greet() {

console.log("Hello World!");

}

If I paste as text I get this:

// create a function named greet()
function greet() {
	console.log("Hello World!");
}
1 Like

@sylumer thank you for your reply. I have solved the problem, but some how paste plain text shortcut is changed to another one.

2024-07-25-gU91DL7x000866

Below are useless bug report.


I have tried cmd+shift+v, but got no text pasted to drafts editor. while normal cmd+v got bad formatted text.

I have tried same command(cmd+shift+v) on Typora(another markdown editor) and it worked well.

So I guess the problem is with drafts…No idea what to do.

I get the formatting issue in way more apps than just Drafts, including exactly the same issues on Windows where Drafts isn’t. That indicates to me it is not a Drafts issue specially, but that drafts is one of many apps that does not get the plain text content of th content copied from VS Code.

So I would once again suggest that it is to do with the format of the content on the clipboard put there by VS code and not on the receiving app per se.

Are you assuming plain text on the clipboard from a text editor? I did, but I don’t think it is quite that.

Note Typora, like VS Code is an electron rather than a truly native app, so they do shat a code base at one level.

Copy some content from VS Code into TextEdit, the default text editor on Mac. When ai do this I get RTF output, not plain text.

Can Drafts be modified to get th plain text? Maybe. But I still think this all stems from the clipboard content from copying in a code editor like VS Code not being plain text.

Sorry I expressed my idea not so clearly. My native language isn’t English.

I admit that this problem is from VS Code, not Drafts. I just want to know how to paste text as plain text with command shift v, as you have described above.

As the image I pasted above, macOS set it to option command shift v. I have searched web but found no solution.

Now my temporary solution is setting paste as plain text action shortcut to command shift v. I want to know if there is an easier way.

If my words offended you, sorry for that.

No offence at all.

You can change keyboard shortcuts in an app via your macOS keyboard settings.

1 Like

Visual Studio Code, and a lot of other Electron-type apps, will put HTML in the clipboard when copying - which is the default behavior of the underlying web controls they use.

This can be in conflict with Drafts, “Paste HTML as Markdown” setting, which tries to convert HTML input to Markdown when pasting.

If you can work around this with “Paste as Plain Text”, as pointed out above. You can also use an action to override this option - or, if you do not want HTML converted to Markdown, you can disable that option completely in Drafts Settings > HTML and just regular “Paste” operations will ignore the available HTML in the clipboard and paste as plain text - which might be your preference.

1 Like

@agiletortoise Thank you. And I wonder if there is an action or setting can change tabs in pasted content to whitespaces(which follow my editor’s settings: two whitespace for tab inserts).

There are several actions in the directory that can do that. It is a find and replac, and there are both standalone and action group actions that facilitate exactly this.