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)


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

bzimport set Reference to bz50419.
AxelBoldt created this task.Via LegacyJun 29 2013, 12:23 PM
Ryasmeen added a comment.Via ConduitOct 29 2013, 9:22 PM

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

Jdforrester-WMF added a comment.Via ConduitNov 26 2013, 1:04 PM

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?

Jdforrester-WMF moved this task to Backlog on the VisualEditor workboard.Via WebNov 24 2014, 4:18 PM

Add Comment