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:

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


Related Gerrit Patches:
mediawiki/extensions/VisualEditor : masterUpdate VE core submodule to master (d49575d46)
VisualEditor/VisualEditor : masterFix visible whitespace rendering in source mode

Event Timeline

Schnark created this task.Jun 25 2019, 8:50 AM
Restricted Application added projects: VisualEditor, Community-Tech. · View Herald TranscriptJun 25 2019, 8:50 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
TheDJ added a subscriber: TheDJ.Jun 25 2019, 2:11 PM

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.

I suspect rGVEDc0799b060844: Source mode performance optimizations is shortcutting, and omits the whitespace replacements.

TheDJ added a comment.Jun 27 2019, 9:38 AM

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

JTannerWMF moved this task from To Triage to Freezer on the VisualEditor board.Jul 2 2019, 4:43 PM
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)

ppelberg closed this task as Resolved.Aug 6 2019, 2:49 AM