Page MenuHomePhabricator

VisualEditor: Auto-selection covers adjacent text over punctuation
Closed, ResolvedPublic

Description

This seems weird to me, but it still might be intentional.

If you put the caret immediately after a sentence ending in a period (e.g. the last sentence of the lede from https://en.wikipedia.org/w/index.php?title=Kono_Statement_of_1993&oldid=546398254&veaction=edit), then click the Link button, it tries to link the last word, including the punctuation.

I would expect it to let you create an new link, without assuming any existing anchor.


Version: unspecified
Severity: normal

Details

Reference
bz48487

Event Timeline

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

This is indeed intentional (and took some time to get right). If the cursor is in, or directly adjacent to, a word, so that you can link a word quickly as a keyboard user without having to use a mouse or do keyboard-based shift-selection.

However, this is meant to not trigger when you're not in the "context" of a word, so it does some fancy language-dependent Unicode whitespace detection; it should be doing this for punctuation but apparently isn't, so referring to Ed to investigate.

Bug.

Because null (the value we get for the end of the sentence) is silently converted to the string 'null' by RegExp#test (!?) and so we think it's an 'ALetter' which triggers the ALetter-MidNumLet-ALetter rule for mid-word punctuation, and so no break is returned.

Related URL: https://gerrit.wikimedia.org/r/64481 (Gerrit Change I2408229cddd876ff8fe55a9eddf9bac87a61457e)

Merged in master; will go out as part of wmf5.