3

In the comment field, as soon as you type @, there appears the auto-complete option to insert another poster's name you want to reply to.

If there is already some text in the comment field, and you move the text cursor to somewhere within the text (not to the end position), then type @ and select a poster's name to insert, some comment text is overwritten. It seems that the text up to the next white-space is affected, the white-space itself and everything after is kept.

I expect the poster's name to be inserted at the location of the cursor, so I consider that behaviour as a bug actually.


Example:

Take this post, go to Add Comment, type abc def gh (including the spaces), move text cursor between d and e, then type @; then select a suggested poster's name, for instance, @aschipfl.

You'll see that ef of the former comment text is overwritten, so the text is now abc d@aschipfl gh.
What I expect is the comment text to be abc d@aschipflef gh.

Note:
Optionally, and auto-inserted space behind the poster's name could also be helpful, so the text of the above example would look like abc d@aschipfl ef gh then.
However this extra-space makes only sense if there isn't one yet and if the poster's name is not placed at end position of the text.

5
  • I have a hard time reproducing this issue. Can you post a step-by-step reproduction scenario? Commented Sep 14, 2015 at 6:47
  • I added an example to clarify the question, @PatrickHofman
    – aschipfl
    Commented Sep 14, 2015 at 7:05
  • So you mean in-word adding of the user name? Commented Sep 14, 2015 at 7:10
  • Yes; actually I encountered the issue when I wrote the comment text and afterwards I moved the cursor to the very first position to insert a poster's name and typed @; after selecting a suggested poster, the first word was overwritten surprisingly...
    – aschipfl
    Commented Sep 14, 2015 at 7:20
  • I've been noticing this myself. Particularly when editing comments.
    – Catija
    Commented Sep 29, 2015 at 17:02

1 Answer 1

2

This will be fixed in the next beta build.

The original logic was to take the mention and the selection and search backwards for /@\S*\z/ then forward for /^\S/, replacing the range with @USERNAME. The /@\S*\z/ was guaranteed to be a partial, case insensitive match for at least part of @USERNAME but /^\S/ could be anything. So @FOO<caret> hello + @foobar = @foobar<caret> hello which is good, but @<caret>Hello world + @foobar = @foobar<caret> world. Also, you probably want the caret to be after the space: @foobar <caret> in most cases.

The new logic continues to match /@\S*\z/ back from the caret, knowing it is a case insensitive substring of @USERNAME but now we:

  1. Search forward with a case-sensitive match for the remaining of the substring.
  2. Remove any whitespace found after the partially matched string.
  3. Include a space at the end of the mention.

Now:

  • @foo<caret>bar + @foobar = @foobar <caret>
  • @<caret>Hello world + @foobar = @foobar <caret>Hello world
  • @<caret> Hello world + @foobar = @foobar <caret>Hello world

Case sensitivity has the following edge case but it lead to an easier implementation:

  • @foo<caret>BAR + @foobar = @foobar <caret>BAR

Interestingly, these are the exact same rules I've observed in Twitter.app.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .