Page MenuHomePhabricator

Syntaxhighlight in NWE out of sync when text contains TAB characters
Closed, ResolvedPublic


When (probably by copy-pasting code) you have a tabulator character in the wikitext, it will be displayed as small arrow, but the syntaxhighlight treats it as long tab and thus is not in sync with the actual text:

Screenshot_2019-06-25 „Wikipedia Spielwiese“ – Bearbeiten – Wikipedia.png (420×626 px, 29 KB)

Either don't use the arrow as replacement, or decrease the tab width with CSS tab-size: 1 (plus browser prefixes).

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

So where was this copied from ? CodeMirror nor CodeEditor uses these replacement characters, and CodeMirror will take whatever is on the pasteboard. It's not the responsibility of the editor to fix this replacement character during pasting.

I just copied from a code file which had the code indented with tab characters. CodeEditor has nothing to do with it, this is about wikitext (which may contain code inside syntaxhighlight tags), not about real code.
No tool does or should replace anything during pasting, the pasted tab characters are still real tab characters. But VE and NWE display a tab character as arrow (just as VE displays a single line break as hooked arrow), which is shorter than the real tab character used by CodeMirror.

For reference, this is ve.visibleWhitespaceCharacters from ve.utils.js.

Actually, CodeMirror still replaces TAB characters by arrows for display, via ve.ui.CodeMirrorAction.static.fixWhitespace. It's NWE that no longer does this replacement, so this must be a regression.

@Schnark totally forgot that NWE brings the VE logic into play. Good analysis !

JTannerWMF added a subscriber: JTannerWMF.

The Editing-team isn't currently prioritizing this work

Actually as this is a regression, we should probably take a look.

Change 521258 had a related patch set uploaded (by Esanders; owner: Esanders):
[VisualEditor/VisualEditor@master] Fix visible whitespace rendering in source mode

Change 521258 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] Fix visible whitespace rendering in source mode

Change 521321 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (d49575d46)

Change 521321 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (d49575d46)