Incorrect cursor placement behavior around markdown formatting

After following a link to a heading, clicking to place the cursor at the end of any line that concludes with Markdown formatting (bold, italics, link brackets, etc.) causes the cursor to appear before the formatting characters rather than at the actual end of the line.

Steps to reproduce

  1. Find or create a file with at least one heading and one line that ends with Markdown formatting characters.
  2. Create a link to that heading.
  3. Follow the heading.
  4. With the section still highlighted (see Figure 1 below), click to place the cursor at the end of a line ending with Markdown formatting.

The following demo file content works nicely:

[Heading link glitch test.md]

*I am italicized*

# I am a heading
This line ends with a **bold statement.**

```here is code ```

[[Heading link glitch test#I am a heading]]

Did you follow the troubleshooting guide? [Y/N]

Yes

Expected result

Cursor appears at the true end of the line (no characters after it). See Figure 2 below.

Actual result

Cursor appears inside any markdown formatting characters present at the end of the line. See Figure 3 below.

Environment

SYSTEM INFO:
Obsidian version: v1.4.2
Installer version: v1.3.5
Operating system: Darwin Kernel Version 21.6.0: Mon Apr 24 21:10:53 PDT 2023; root:xnu-8020.240.18.701.5~1/RELEASE_X86_64 21.6.0
Login status: logged in
Catalyst license: supporter
Insider build toggle: on
Live preview: on
Legacy editor: off
Base theme: dark
Community theme: none
Snippets enabled: 0
Restricted mode: on

RECOMMENDATIONS:
none


Additional information

It appears to be connected with the fact that the section pertaining to that heading is highlighted. As long as the highlighting remains, clicking on an affected line will cause the behavior (unless the syntax is already exposed. The only exception I have found is if you have already exposed the syntax by moving the cursor with the arrow keys.

Figure 1: Highlighted section after following the heading link.
image

Figure 2: Expected cursor placement when you click the end of the “bold statement” line.
image

Figure 3. Actual cursor placement when you click the end of the “bold statement” line.
image

2 Likes

I also just discovered that the same thing occasionally happens when clicking to the end of those lines straight from another window (Obsidian or otherwise), at least in Windows 10*. I can’t see any consistent factor that correlates with whether it will happen or not, though, so I don’t know if it’s related. It also appears to never happen when just clicking between tabs in split view or clicking into a file after having a sidebar in focus.

* I can’t test it in macOS (Monterey or Ventura) since you can’t click straight to a specific line when the window isn’t in focus (clicking on the window just brings it into focus with the cursor wherever you left it last).

I’m still observing this behavior in v1.5.3. I also now occasionally see it when clicking between files onto formatted text while in split view.

thanks

+1 this happens most of the time.

+1 Very frustrating. I thought “source mode” might fix the problem, but it happens there as well. The only way to access that chunk of text is to click after it, and move backwards 100s of spaces. :frowning: