Vim mode: jumping to first or last character of inline code is incorrect

Jumping to the first letter of in-line code, such as `foo` with f or t jumps to the first backtick instead of the first letter. The same happens if the cursor is placed after the backticks and trying to jump backwards to the first letter using F. However, it doesn’t happen if the cursor starts inside the backticks.

It also happens when trying to jump to the last letter from after the backticks using T (but not with F).

This happens only in live preview mode, not in source mode. Doesn’t happen in CodeMirror either.

Steps to reproduce

  1. Enable vim mode and live preview mode
  2. Type the following text:
lorem `ipsum` dolor
  1. Move the cursor to the beginning of the line and try to jump to the “i” of “ipsum” by typing either fi or tp
  2. Also: move the cursor to the end of the line and try to jump to “m” of “ipsum” by typing Tm

Expected result

The cursor should move on top of “i” in the first case and on top of “m” in the second case.

Actual result

In the first case, the cursor moves to “i” but then quickly jumps to the first backtick `. In the second case, the cursor jumps to after the last backtick.

Environment

  • Operating system: Ubuntu 20.04
  • Debug info:

SYSTEM INFO:
Obsidian version: v0.14.6
Installer version: v0.14.6
Operating system: #44~20.04.1-Ubuntu SMP Thu Mar 24 16:43:35 UTC 2022 5.13.0-39-generic
Login status: logged in
Catalyst license: insider
Insider build toggle: off
Live preview: on
Legacy editor: off
Base theme: dark
Community theme: none
Snippets enabled: 0
Safe mode: on

RECOMMENDATIONS:
none

does it happen here https://codemirror-vim--util.repl.co/?

Doesn’t happen in that editor. It seems to have something to do with how the live preview mode switches between showing the rendered markdown and the source when the cursor enters the backticks.

The same thing also happens with links (both wikilinks and href), jumping to the first letter of the link label with f puts the cursor on top of the square first bracket.

Interestingly it doesn’t happen with the dollar symbols of math/latex.