#[non_exhaustive]pub enum Gesture {
Show 15 variants
WrapRange(InlineKind),
ToggleInline(InlineKind),
SetBlock,
ToggleBlockContainer(BlockContainerKind),
InsertThematicBreak,
ToggleCodeBlock,
SetCodeLanguage,
ToggleTaskItem,
SetTaskChecked,
ToggleTaskChecked,
InsertLink,
InsertImage,
InsertFootnote,
InsertLiteral,
InsertLineBreak,
}Expand description
One authoring gesture, named with whatever kind it takes — the question
Format::supports answers.
Twig’s formats are ragged: Djot spells all eight inline marks and
Markdown three, HTML spells marks and nothing block-level, XML and AsciiDoc
spell nothing. Every Editor method already reports that as
Error::UnsupportedFormat — but only once called, which is too late for a
UI that wants to disable the button rather than let it fail.
A variant carries a kind exactly where the Editor method takes one, so
the query is spelled with the same value as the call:
if Format::Markdown.supports(Gesture::ToggleInline(InlineKind::Mark)) {
// never runs: `==mark==` is emit-only in Markdown.
}Only the gestures with a format-level gate appear. Three are absent for two different reasons:
Editor::split_blockconsults the format only for the block it lands in (a fence inside a code block, a heading marker inside a heading, nothing at all in a paragraph). Its answer is a property of the caret, so no format-only query could be honest about it.Editor::renumber_ordered_listsand the table ops read no format spelling at all — they rewrite structure already in the source and refuse on position, never on format.
#[non_exhaustive] for the reason Format is: the gesture list grows with
the editor surface, and a caller matching on this should not need a rebuild.