Wrong amount of symbols is selected after undoing text style

Steps to reproduce

  1. Type bold text alongside with not styled one, i.e. **This** is bold text
  2. Select with a cursor the bold text with asterisks
  3. Press Cmd+B two times (to undo and then redo bold text)
  4. Bold styling includes a letter from the next word: **This i**s bold text

Works with other styling types such as italic and with underscores as well.

Did you follow the troubleshooting guide?

Yes, reproducible in the sandbox vault

Expected result

Undo operation on styled text shouldn’t select more symbols than were in the original styling.

Actual result

Undo operation on styled text captures more symbols into selected state than were in original styling.


OS: macOS Sonoma 14.4.1
Obsidian: Version 1.5.12 (Installer 1.4.16)

Additional information