ckruse / cforum

https://github.com/ckruse/cforum_ex/
GNU Affero General Public License v3.0
22 stars 5 forks source link

Conditionally include tildes instead of backticks. #689

Closed CountOrlok closed 7 years ago

CountOrlok commented 7 years ago

This should do the trick. If there's nothing selected and the cursor position is preceded by two newlines, then tildes for a code block will be included instead of backticks for inline code. Nevertheless, I do recommend some further tests, because I encountered a really weird bug doing my own tests:

Everything seemed to work as intended, but at some point, when I selected text that definitely included newlines, pushing the button resulted in only the first line being wrapped in backticks, with the rest of the selected text being ignored.

I really can't explain this behavior and was not able to consistently reproduce it.