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)
Open, LowPublic

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

Details

Reference
bz50419
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.

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 12 2016, 6:23 PM

Add Comment