Typing three backticks and then pressing Escape or Enter does not result in what I expect

For code blocks such as

echo "Hello."

I often need to type three backticks.

Steps to reproduce

Type any number of backticks into the editor and while the last backtick is waiting for another character in order to produce something like à or è, press Enter or Escape.

Expected result

After typing three backticks and then pressing Enter, I want to start a new line so that I can begin filling the code block, in the above example, with echo "Hello.".

After typing three backticks and then pressing Escape I want the last backtick to stop waiting for a new character so that I can begin typing ad-note (for the Admonition plugin) and then press Enter, just as I would type the programming language, for example bash or python. Without pressing Escape after three backticks, I’d get two backticks followed by the character à instead of three backticks followed by a.

Actual result

In the case of pressing Enter after typing three backticks, I get a forth backtick which I then have to manually delete, instead of beginning a new line where I can type the content of the code block.

In the case of pressing Escape after typing three backticks, I get a forth backtick and also some sort of whitespace character, which I both have to delete manually.

Environment

  • Operating system: macOS
  • Obsidian version: 0.12.19

Additional information

Whatever you are using to obtain this effect is not compatible with our editor. Please, open a feature request.

Thanks for the quick reply. I’m using the regular German QWERTZ keyboard layout. Otherwise, I’m using nothing else.

I switched to the US QWERTY keyboard layout for testing, where the backtick does not wait for another keypress. I did not know that. Apparently, the backtick key works very differently for Americans than it does for Germans.

@bfhdavid

What you describe here results from dead key behavior of the keyboard layout. If you want to use regular German QUERTZ layout, but without annoying dead key feature, I would recommend this layout.

2 Likes

Thanks so much! I didn’t know about dead keys. And yeah, that tilde key problem in Vim was bugging me as well. I assumed that’s just how it’s supposed to be, that it’s like that for everyone else, too. So you fixed two problems with one stone, thanks!

@saf-dmitry Now that I’m aware of dead keys, I noticed that I get the exact same weird behavior in VS Code too.

However, in Apple Notes or macOS TextEdit I get the desired behavior I described in the “Expected behavior” section. That’s why I never knew about dead keys.

Vim behaves in yet another different, third way regarding backticks.

So at least it’s not a bug in Obsidian. Just wondering, since Obsidian and VS Code behave in the same way, maybe it’s a bug in Electron? I don’t know much about that though.

It’s just kind of disappointing that the solution to the weird behavior in VS Code/Obsidian is that I should change my keyboard layout. Or rather, that all Germans and possibly even all Europeans need to change their keyboard layout if they want to experience the app like it’s supposed to be experienced. Not to mention the other non-English keyboard layouts I know nothing about.

1 Like

@bfhdavid I also find dead key functionality rather annoying, especially when coding, using Terminal, or writing some kind of markup e.g. Markdown, LaTeX, etc. On macOS I use the German layout with dead key support deactivated, which I mentioned in my previous post. On Linux I deactivate dead key support too, and have no problem using Obsidian or other Markdown writing environment.

1 Like