Jumping cursor when indenting text in Source Mode

Steps to reproduce

To reproduce:

  • Open the Sandbox Vault.
  • Disable “Show indentation guides”.
  • Insert a tab character and type any character.

Expected result

  • Behave like the Legacy Editor:
    • When you insert the tab, move the cursor the correct number of spaces (4 by default)
    • Don’t move the cursor when you start typing

Actual result

  • When you insert the tab, the cursor moves ahead more than the correct number of spaces
  • When you type a letter, the cursor moves to the LEFT, then inserts the character

Environment

  • Operating system: macOS
  • Debug info:
SYSTEM INFO:
	Obsidian version: v1.0.3
	Installer version: v0.15.8
	Operating system: Darwin Kernel Version 21.6.0: Thu Sep 29 20:13:56 PDT 2022; root:xnu-8020.240.7~1/RELEASE_ARM64_T6000 21.6.0
	Login status: logged in
	Catalyst license: none
	Insider build toggle: off
	Live preview: off
	Legacy editor: on
	Base theme: dark
	Community theme: none
	Snippets enabled: 0
	Restricted mode: off
	Plugins installed: 6
	Plugins enabled: 1
		1: List Modified v1.3.3

RECOMMENDATIONS:
	Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.

Additional information

Slightly more context here

Both this and Misaligned line gutters with indented text are due to what parser thinks those lines are (regular text, codeblock, etc) and consequently how they should be rendered (font, spacing, gutter).

This is a hard problem and, to be frank, is a very low priority one.
If you are annoyed by this behavior, I suggest you create a custom CSS with no customizations at all and a simple monospace font for everything, basically strip away everything and just have a really plain text editor.

Maybe that’s what we should do with “source mode” now that there is “live preview”.

This is a hard problem and, to be frank, is a very low priority one

That might be true, I don’t know. But I do know that the Legacy Editor solved this hard problem. It doesn’t experience this bug.

Might be solvable with CSS, but Legacy Editor works great for me, so I’m going to continue to use it.

This is a hard problem

Can you elaborate on the problem?

Not the symptom, obviously, I can see that just fine, but you know what’s causing it in the new editor?