Page MenuHomePhabricator

Preformatted text (by entering a space) does not apply on first line in new topic
Open, Needs TriagePublicBUG REPORT

Assigned To
None
Authored By
Jidanni
Oct 3 2023, 9:01 AM
Referenced Files
Restricted File
Oct 4 2023, 8:48 AM
F37942186: 20231004T034151.jpg
Oct 4 2023, 8:47 AM
F37926063: 20231003T035556.jpg
Oct 3 2023, 9:01 AM
F37926061: 20231003T035527.jpg
Oct 3 2023, 9:01 AM

Description

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

  • On some Talk page click to add a new topic.
  • Make sure you use Source instead of Visual.
  • In the Source editor indent the first line enter a Space character, then write some text.
  • Create a second line of text.

What happens?:
The plain Source preview just shows regular text for the first line, instead of using <pre>.
And when we save it indeed we just get regular text.

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

20231003T035527.jpg (244×894 px, 9 KB)

20231003T035556.jpg (428×1 px, 22 KB)

Event Timeline

Aklapper changed the task status from Open to Stalled.Oct 3 2023, 9:17 AM
Aklapper added a project: DiscussionTools.

In the Source editor indent the first line.

How? Please always read and follow https://www.mediawiki.org/wiki/How_to_report_a_bug and provide full steps (e.g. you seem to go to visual mode at some point and your steps do not include this).

You need to first click 'Add topic'

20231004T034151.jpg (89×183 px, 3 KB)

Now in the Description field,
{F37942193}
add one space and then a word, and hit enter, to go to the second line.
Now on the second line enter another word.
You can see the problem immediately: in the preview area that is being updated as you type, you will see that the space has been ignored. (And indeed if we save the file the space has been discarded.)

At this point we are still in the Source tab and have not clicked on Visual yet. Indeed no clicking on Visual is needed to investigate this bug. Thanks.

The Visual preview shows the indentation acting correctly, creating a quote. Alas:

Space never indents a line and space does not "create a quote".
Space creates preformatted text.

Please see https://www.mediawiki.org/wiki/Help:Formatting for text formatting in MediaWiki.

Aklapper renamed this task from Indentation lost on first paragraph to new topic to Preformatted text (by entering a space) does not apply on first line in new topic.Oct 4 2023, 9:21 AM
Aklapper updated the task description. (Show Details)

You need to first click 'Add topic'

For future reference, please update the task description to be complete and clear, and always follow https://www.mediawiki.org/wiki/How_to_report_a_bug
Incomplete and ambiguous bug reports are not a good use of anybody's time.

Aklapper changed the task status from Stalled to Open.Oct 4 2023, 9:23 AM

Happens because the posting API does $wikitext = CommentModifier::appendSignatureWikitext( $wikitext, $signature );, which calls CommentUtils::htmlTrim on the wikitext (which strips the opening/closing whitespace). I can't remember if we're doing that for a specific reason.