Skip to main content

Module mention_picker

Module mention_picker 

Expand description

The @ picker every rich-text field offers: typing @ and a few letters lists the workspace’s people and agents under the caret, narrowed as the name is typed, and picking one puts a mention of them in the text — one marked run naming their participant id (Mark::Mention), not prose that happens to start with @.

Who is offered is the workspace’s roster (PresenceCtx::roster), the same participants and names every app’s presence shows; an owner can add participants its record knows of that the roster does not (someone who wrote in a channel and has since left). What was typed stays in the text while the list is open, so a person who keeps typing past the list, or never picks, has written ordinary text.

  • Arrow Up / Down move the armed row; Enter or Tab picks it.
  • Escape closes the list for this @; typing on keeps it closed until another @ starts.
  • A click on a row picks it; hovering arms it.

The list is a SuggestionList anchored at the @, painted in the window’s top layer.

Structs§

MentionCandidate
Someone a field can mention: a participant of the workspace.
MentionQuery
The @-run the caret sits in.

Functions§

merged_roster
The roster presence names merged with what an owner adds: one entry per participant id, the roster’s answer winning, sorted by name.
query_at_caret
The @-run ending at caret in text, if the caret is in one: an @ that opens a word (at the start, after whitespace or after punctuation that is not part of a word), followed by at most MAX_QUERY_LEN bytes with no newline and no other @. An @ inside a word — an email’s a@b — opens nothing.
rank
The candidates worth offering for query, best first, ranked as every list search ranks (crate::search::ranked_rows): a prefix of the whole name, then of a later word (“lov” finds “Ada Lovelace”), then the participant id. Within a rank the given order holds, so the list does not reshuffle while a name is typed. An empty query offers everyone.