Page MenuHomePhabricator

Add space between cursor and ping
Open, Needs TriagePublic

Description

Behavior

  1. Open the Reply tool's visual mode
  2. Type @
  3. Highlight the username of the person you would like to ping; let's call them USERNAME
  4. Press

Actual

  1. Observe @USERNAME is shown in the text input area with your cursor immediately next to the final E in USERNAME

Expected

  1. Observe @USERNAME is shown in the text input area with a space between your cursor and the final E in USERNAME

Event Timeline

Note that this would be undesirable behaviour in languages that don't use spaces.

Another case to consider is that users may want to type other punctuation before a space, for example a comma or a colon, e.g. @User:

Meetings notes
Notes from the conversation @Esanders, @iamjessklein and I had this morning about this:

Note that this would be undesirable behaviour in languages that don't use spaces.

Ed shared the tool could determine whether a space should be inserted after someone is selected from the username suggestion list by making an assumption about what language the user is typing in.

Said "assumption" would need to be based off of one of the following heuristics[i]:

  1. The script used in the username that is being selected from the username suggestion list
  2. The interface language the user has set
  3. The content language the user has set
  4. The word-seperator config
  5. Create a new config to replace word-seperator
    • Note: there could be cases where people are writing comments in a language that is different from the content language in which the space behavior would be undesirable.

i. Note: 1-4 would not be completely reliable in determining what language someone is typing in.

Somewhat related, we added support for a suffix in T268588. Wikis that want this could set that message.

I don’t think suffixes are appropriate solution for this task. Suffixes are part of the ping and thus cannot be removed without removing the whole ping (can they?). Languages like English require a space after the user name except if there’s some punctuation following (comma, colon, apostrophe etc.), so if the space could not be removed, it would lead to incorrect spelling (which is especially hard to read if the punctuation ends up being the first character in a row, with the ping itself staying in the previous one).

@Tacsipacsi it'd work for source mode, but not visual. So yeah, probably not a good enough substitute.