Page MenuHomePhabricator

Auto-indentation in wikitext adds spacing after the cursor when a space is after the cursor
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Type Preformatted (or even just a lone space ) and place the cursor at the beginning of the line
  • Hit Enter several times

What happens?:

The indentation grows larger with each newline

What should have happened instead?:

It should maintain the same indentation as the line above it.

Other information (browser name/version, screenshots, etc.):

Reported at https://www.mediawiki.org/wiki/Special:Permalink/8357524#Please_add_a_preference_to_disable_%22auto_indentation%22

From cursory testing, it looks like using insertNewlineAndIndent behaves better than insertNewlineKeepIndent, which was added in T389328.

Event Timeline

insertNewlineAndIndent will replace tabs with spaces. Ideally, insertNewlineKeepIndent should be fixed upstream.

Change #1278206 had a related patch set uploaded (by Bhsd; author: Bhsd):

[mediawiki/extensions/CodeMirror@master] CodeMirror: correct the command insertNewlineKeepIndent

https://gerrit.wikimedia.org/r/1278206

Bhsd changed the task status from Open to In Progress.Apr 28 2026, 6:05 AM
Bhsd claimed this task.

I wonder if it is worth reporting upstream. It is reproducible on the CodeMirror playground, but it is not very clear what the expected behavior is.

Change #1278206 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] CodeMirror: correct the command insertNewlineKeepIndent

https://gerrit.wikimedia.org/r/1278206

Bhsd moved this task from Bugs to Done on the MediaWiki-extensions-CodeMirror board.