In code blocks, fast insertion of spaces for indentation inserts a dot

I stumbled over a weird behavior with indentations in code blocks.

Steps to reproduce

Consider a code block like the following where some lines are indented:

```
   ab
cd
   ef
```

I place the cursor in front of cd and press the space bar three times in short succession.

Expected result

cd is now aligned with the other lines:

```
   ab
   cd
   ef
```

Actual result

When hitting the space bar fast enough, instead a . and a space are inserted and the first character is removed:

```
   ab
. d
   ef
```

Further observations

  • This does not happen when I am typing outside of a code block
  • There needs to be an indented line before and after the affected line
  • The surrounding lines need to be indented with at least 3 spaces or one or more tabs
  • reproducible in the sandbox vault

Environment

  • Operating system: macOS Ventura 13.0.1
  • Debug info:
SYSTEM INFO:
	Obsidian version: v1.0.3
	Installer version: v0.15.9
	Operating system: Darwin Kernel Version 22.1.0: Sun Oct  9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000 22.1.0
	Login status: not logged in
	Insider build toggle: off
	Live preview: on
	Legacy editor: off
	Base theme: dark
	Community theme: none
	Snippets enabled: 0
	Restricted mode: on

RECOMMENDATIONS:
	none
1 Like

I can’t reproduce. Maybe you have a text expander that is doing this.

I found the culprit: There is a setting on macOS to insert a dot on double-space, something that apparently was adapted from iOS a while ago.

Turning this setting off removes the issue for me.

However, it is worth noting that with the setting turned on, the behavior of the obsidian editor is still buggy, given that a double-space is usually ignored except under very specific conditions as described above, and also the removal of the next character should not occur.

3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.