Page MenuHomePhabricator

VisualEditor: Selection over a line (with shift-down) applies formatting changes to second line (where logical selection ends), not just first line (where visible selection ends)
Closed, ResolvedPublic

Description

Suppose an article contains two lines in Paragraph formatting, and we want to turn the first one into Heading formatting. Select the entire first line (Cursor at beginning of line, Shift-CursorDown) then choose Heading formatting from the selection box at the top. Result: both lines are turned into Headings, not just the first. (Bold and italics formatting changes work correctly and affect only the current line.)


Version: unspecified
Severity: normal

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:50 AM
bzimport set Reference to bz50419.

This issue exists for all kind of formatting from the Headings pull-down menu.

This is the same behaviour as in other rich editors.

By selecting in the manner you've stated ("Cursor at beginning of line, Shift-CursorDown") you've selected the current text, the current line, AND the newline into the place before the first character.

If you mark the text as bold (which is character-level) the boldness becomes a "pre-annotation" on the second line before the first character (so typing anything at that point will become bold).

However, changing the format (rather than styling) of some text applies to the entire paragraph (because that's how HTML works) – i.e., the entire second line gets this applied.

We could theoretically apply different behaviour for styling and formatting, so we apply over a newline for the first but not the second, but that might be more unexpected?

In Microsoft Word, both character-level styling and paragraph-level formatting are only applied to the one line that was selected either with Cursor-at-beginning-plus-Shift-Cursor-down or with a triple-click. In three of these four scenarios, VE behaves as Word.

As far as I can see, applying character-level styling to a line selected with Cursor-at-beginning-plus-Shift-Cursor-down does not become a pre-annotation on the following line (neither in Word nor in VE): the styling is not applied if I insert text at the beginning of that line.

Change 980439 had a related patch set uploaded (by Esanders; author: Esanders):

[VisualEditor/VisualEditor@master] Don't convert empty-selected paragraphs

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

Change 980439 merged by jenkins-bot:

[VisualEditor/VisualEditor@master] Don't convert empty-selected paragraphs

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

Change 981374 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (402570007)

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

Change 981374 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (402570007)

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

EAkinloose subscribed.

Line with cursor gets heading(or other) formatting applied

Screenshot 2024-01-08 at 17.27.51.png (190×2 px, 46 KB)