Pressing delete when macOS text replacement is queued up deletes subsequent content as well

Steps to reproduce

  1. Follow the troubleshooting guide
  2. On a Mac, create a text replacement (e.g., $alpha𝛼) in System Settings
  3. In Obsidian, in any note, create a heading line (# Heading)
  4. On the line above the heading, type your text replacement trigger but don’t press space (so you still see the little replacement window thing)
  5. Press the delete key

Expected result

Just the last character you typed gets deleted

Actual result

The text replacement gets inserted, and the heading gets deleted.

Environment

SYSTEM INFO:
	Obsidian version: v1.5.6
	Installer version: v1.4.16
	Operating system: Darwin Kernel Version 23.3.0: Wed Dec 20 21:33:31 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T8112 23.3.0
	Login status: logged in
	Catalyst license: insider
	Insider build toggle: on
	Live preview: on
	Base theme: adapt to system
	Community theme: none
	Snippets enabled: 0
	Restricted mode: on

RECOMMENDATIONS:
	none

Additional information

Does it happen in source mode?

This may be a bug of MacOS, we have no control over text replacement. It’s something that is acted upon Obsidian by OS emulating keyboard or mouse input.

Yes, it also happens in source mode.

just adding a +1 to this, its a problem on my machine too, including in sandbox

Download and reinstall obsidian, is this still happening?

Does it happen only when the text after is a heading?

Still a problem after reinstalling with installer version 1.6.3, in sandbox vault.

If the replacement is above a header, it will delete the entire header line.
If the replacement is above plain text, it will delete the remaining line and line break that replacement is on (moving the line below it up)

See screen video:
Screen Recording 2024-07-04 at 6.11.48 PM.zip (573.1 KB)