Skip to main content

Module selection

Module selection 

Expand description

What a person has selected, carried to whoever is asked to act on it.

A person selects a sentence in a document, a range of cells or a row in a list, and asks an agent about it. The agent must act at exactly that place through the actions the resource publishes, so the selection travels in the resource’s own terms: a SelectionPlace is the same value an action takes as its place argument ({"item": id, "start": n, "end": n}, in characters), an InteractionAnchor names selections that are not text (cells, objects, rows), and a short excerpt lets a reader see what was selected without opening the resource. None of it grants authority: the agent still reaches the resource only through permission-filtered actions.

Structs§

SelectionAnchor
What was selected: where (a place, an app-native anchor, or both) and a short excerpt of it. Every part is optional; an empty anchor says nothing and is dropped by Self::non_empty.
SelectionPlace
Where a selection is inside a resource: an item, a caret or a character range inside one item. Its JSON form is exactly what an action’s place parameter takes (tilo_resource::Place), so an agent hands it back unchanged.
SelectionSubject
What a request is about: the resource a person had selected something in, and the selection. Only the subject of the request: it carries no authority, so a run about a selection may act anywhere its starter and its agent may (other resources, other apps), as any task may.

Constants§

BOUND_RESOURCE_PREFIX
What a resource id starts with when a window publishes it under the toolkit’s transport alias: <prefix><host>:<publication>:<hex of the app's own id>. The window’s actions are addressed by the alias; the app names the resource by its own id (a selection’s subject does), so a reader matching the two decodes the alias (logical_resource_id).
MAX_EXCERPT_BYTES
The most bytes an excerpt may take at a trust boundary.
MAX_EXCERPT_CHARS
The most characters an excerpt keeps. A selection is context for a request, not its payload: a longer one is cut and ends in ….
MAX_PLACE_ITEM_BYTES
The most bytes a place’s item id may take.
MAX_SELECTED_ITEMS
The most items a selection of several items (files, rows, cards) names one by one; the excerpt counts the rest.
MAX_SELECTION_ANCHOR_BYTES
The most bytes an interaction anchor may take, encoded.

Functions§

excerpt_of
text as a selection excerpt: trimmed, at most MAX_EXCERPT_CHARS characters (a longer one is cut and ends in …), without control characters other than line breaks and tabs. None when nothing is left.
logical_resource_id
The app’s own id for the published resource id: the id inside a BOUND_RESOURCE_PREFIX alias, or id itself when it is no alias (or a malformed one).