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)

  • Current version: v1.6.7
  • Installer version: v1.4.16

Additionally, captured in this screen recording:
Screen Recording 2024-09-22 at 9.06.52 PM.mov.zip (3.0 MB)

  1. Typing a >= 2 character text replacement and then hitting the delete key deletes a heading and its collapsed content on the next line
  2. Typing a 1 character text replacement and then hitting the delete key and then clicking the left mouse button deletes a heading and its collapsed content on the next line
  3. Typing a >=2 character text replacement and then hitting the delete key deletes a bulleted item on the next line
  4. Typing a >=2 character text replacement and then hitting the delete key deletes a bulleted item and its collapsed content on the next line

I had a significant déjà vu moment months ago where I was typing something in my notes, thought I had written the same thing before, went into File recovery and then found a whole heading with said information contained in it that had already been written. I had thought I had cut the deleted heading and its contents to move them somewhere else and then never pasted them, but after a similar phenomenon happened to me again a moment ago where I was typing at speed and saw a whole heading and its content disappear, undoing and redoing the mass deletion before understanding what was happening, I think typing a text replacement and hitting the delete key in this manner may have actually been the culprit since I don’t generally cut and paste in Obsidian.