Page MenuHomePhabricator

Spacing before typing in old WikiEditors causes empty-character spacing duplication under CodeMirror mode in Modern, MonoBook, and Timeless skins
Closed, DeclinedPublic

Description

I switched to Modern skin and then MonoBook skin to test out the syntax highlighting feature at IE11.

When I began the line by pressing the space bar, I saw one empty character highlighted. I entered space some more, entered a word, and then pressed . Then the empty characters from one line duplicates into another line. Also, the text cursor starts at the point between the space and the first word.

Nevertheless, when I removed the spaces, entered some words, and hit , the cursor starts at the beginning.

Left image comes from Modern; right, MonoBook.
modern skin syntax highlighting.PNG (706×547 px, 26 KB) monobook skin syntax highlighting.PNG (787×813 px, 78 KB)

EDIT: I now realize that the issue extends to other browsers, like Chrome and Firefox, and another skin, Timeless.

Event Timeline

gh87 renamed this task from Spacing before typing in old WikiEditors causes empty-character spacing duplication under CodeMirror mode in IE11 (Modern and MonoBook skins) to Spacing before typing in old WikiEditors causes empty-character spacing duplication under CodeMirror mode in Modern, MonoBook, and Timeless skins.Mar 29 2018, 9:10 AM
gh87 edited projects, added Timeless; removed Browser-Support-Internet-Explorer.
gh87 updated the task description. (Show Details)

This is not a bug, this in the intended functionality. The empty character is highlighted to make it easy for the editor to know that they are adding preformatted text. It makes editing much easier because the character is automatically inserted on every line until you delete it and then it doesn't get copied anymore.
See Preformatted text section on https://www.mediawiki.org/wiki/Help:Formatting for more information.

To clarify,

the empty characters from one line duplicates into another line. Also, the text cursor starts at the point between the space and the first word.

I think is also intentional (not just that the initial space is automatically inserted). The idea here being that people sometimes use the preformatted text for multi-line examples, where indentation is important. e.g.

Heading
  Foo
  Bar

  Sub-heading
    Foo
    Bar

Bad example maybe, but anyway if you type this in line by line, you'll see how the automatic indentation makes it easier.

Strange (or weird) that it's intended for it applies to only those using the CodeMirror mode but not for ones not using it. Ah well, close it if you wish.