Inline spaces are unexpectedly deleted when pressing Enter in the middle of a line

Steps to reproduce

  1. Create a new note and type a b (with one or more spaces in between).
  2. Place the cursor at the end of a (i.e., right before the first space), or place it between a and the spaces.
  3. Press Enter.

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

Y

Expected result

The spaces should be preserved. After the line break, the new line should start with a space:

a
 b

Actual result

All spaces between the two characters are deleted, and the text becomes:

a
b

Environment

SYSTEM INFO:
	Obsidian version: 1.13.7
	Installer version: 1.8.10
	Operating system: Windows 11 Home China 10.0.26200
	Login status: logged in
	Language: zh
	Catalyst license: none
	Insider build toggle: off
	Live preview: on
	Base theme: adapt to system
	Community theme: none
	Snippets enabled: 0
	Restricted mode: on

RECOMMENDATIONS:
	none

Additional information

  • The number of spaces does not matter — whether 1 or 20, all spaces are removed when pressing Enter.
  • If there is no preceding text (e.g., typing b and pressing Enter before the spaces), the spaces are preserved. This indicates inconsistent behavior between “leading spaces” and “inline spaces.”
  • This bug does not occur inside blockquotes (> ) or fenced code blocks (```) — spaces are preserved as expected in those contexts.
  • I tested the same operation in other editors for comparison:
Environment Preserve inline spaces?
Windows Notepad Yes :white_check_mark:
VS Code Yes :white_check_mark:
dillinger - online Yes :white_check_mark:
Stacjedit - online Yes :white_check_mark:
Plainly - online Yes :white_check_mark:
markdown.com.cn Yes :white_check_mark:
MeTool - online No :cross_mark:

I checked CodeMirror’s deleteMarkupBackward fix (v6.1.1, released Aug 2023), but it appears unrelated.