Single Backticks - Don't create new pair when closing an existing pair; also, press Enter to finish backticking

environment: Appimage on PopOS (Ubuntu 22.04), Logseq version 0.8.1.

I’d like to see the single backtick behave like [[ and (( sequences for pages and block references.

Currently, single backticks create a pair when a single backtick is typed; then, after text is entered between them, and the closing backtick is typed, a new pair is created (for a total of three backticks so far) after the cursor moves to the right of the closing backtick, instead of the cursor just moving to the right of the already existing closing backtick and not creating a new pair, like page and block references do.

Also, when a backtick pair is created by typing a single backtick, text is entered, and Enter is pressed on the keyboard, a newline is created, instead of the cursor moving to the right of the closing backtick, which is what page and block references do. There is no use case for a newline in-between backticks, as far as I know.

Example of the first case (hopefully I don’t botch the escape sequences for showing literal backticks):

  • type “`” and "``"appears.
  • type text: “`foo`” is showing
  • type a backtick: now “`foo```” appears, with the cursor to the right of the closing backtick, but with a new pair created to the right of the cursor.

image

Instead, the cursor should just move to the right, both when the closing backtick is typed, and when Enter is pressed.

I disagree about pressing Enter. Generally keys should try to stay consistent about what they do; Enter should finish the current line and start a new block, generally. I agree it is weird to split the trailing ` onto the next line when you do that, but I would find overloading Enter like this confusing and frustrating more often than not, when I’m just typing text.

Yeah, that’s a valid point. So when I updated logseq a few weeks or so after I wrote this, the bug was fixed, and typing the closing backtick behaved as expected, by just moving the cursor beyond the existing closing backtick, or replacing it, whichever it’s doing.

I think in light of there being a single key to close a pair of surrounding characters (whether that’s backtick, parentheses, etc), namely the actual closing character itself, there’s really no reason to have Enter do the same job.

Enter is performing autocompletion of the word(s) in the page a block references as well, so I think you can argue it’s a different behavior than just completing single closing character, and valid there, but probably not necessary in closing single characters.