Expand description
§dartboard-editor
Host-neutral editor state and dispatch for the dartboard terminal drawing
tool. This crate has no terminal-I/O dependencies — hosts construct
AppIntent values from their own input layer and feed them to the
editor.
§Host wiring
- Own an
EditorSessionand adartboard_core::Canvas. - Translate your host’s input events into
AppKeyandAppPointerEvent. Pointer coordinates are 0-based cell positions in the host’s display grid; the host is responsible for any terminal protocol conversion (e.g., SGR 1-based → 0-based). - Route key input through
KeyMap::resolveplushandle_editor_action(orhandle_editor_key_pressfor the default keymap path). - Route pointer input through
handle_editor_pointer; if your host has overlay UI (swatches, menus), hit-test those first and only forward events that should reach the editor. UseEditorSession::viewport_containsfor canvas hit-testing. - Inspect
EditorPointerDispatch::outcome:PointerOutcome::Consumedmeans suppress outer UI;PointerOutcome::Passthroughmeans the editor did not act on the event and the host may bubble it to outer layers.
§Default pointer policy
handle_editor_pointer implements the hover policy most hosts want:
passive AppPointerKind::Moved events over the canvas do not
move the caret when no floating preview is armed, and do follow
the cursor when one is (so brush/stamp previews track the pointer).
Layered hosts should simply forward every AppPointerEvent they
want the editor to see and rely on PointerOutcome to decide
whether to bubble.
Crossterm adapters for the reference CLI live in the dartboard-cli
crate. Non-crossterm hosts (e.g., VTE-based shells) construct
AppIntent values directly from their own parsed events.
Re-exports§
pub use keymap::ActionSpec;pub use keymap::BindingContext;pub use keymap::EditorContext;pub use keymap::HelpEntry;pub use keymap::HelpSection;pub use keymap::KeyBinding;pub use keymap::KeyMap;pub use keymap::KeyTrigger;pub use session_mirror::ConnectState;pub use session_mirror::MirrorEvent;pub use session_mirror::SessionMirror;
Modules§
Structs§
- AppKey
- AppModifiers
- AppPointer
Event - A pointer event in the host’s display grid.
- Bounds
- Clipboard
- Editor
KeyDispatch - Editor
Pointer Dispatch - Editor
Session - Floating
Selection - PanDrag
- Selection
- Swatch
- Viewport
Enums§
- AppIntent
- AppKey
Code - AppPointer
Button - AppPointer
Kind - Editor
Action - Host
Effect - Mode
- MoveDir
- Pointer
Outcome - Whether
handle_editor_pointerconsumed the event or left it for the host to bubble to outer UI layers. - Pointer
Stroke Hint - Selection
Shape - Swatch
Activation
Constants§
Functions§
- backspace
- begin_
paint_ stroke - capture_
bounds - capture_
selection - copy_
selection_ or_ cell - cut_
selection_ or_ cell - delete_
at_ cursor - diff_
canvas_ op - dismiss_
floating - draw_
border - draw_
selection_ border - end_
paint_ stroke - export_
bounds_ as_ text - export_
selection_ as_ text - export_
system_ clipboard_ text - fill_
bounds - fill_
selection - fill_
selection_ or_ cell - handle_
editor_ action - handle_
editor_ key_ press - handle_
editor_ pointer - Apply a pointer event to the editor and return the dispatch outcome plus any paint-stroke grouping hint the host should honor for undo bookkeeping.
- insert_
char - paint_
floating_ drag - paste_
primary_ swatch - paste_
text_ block - pull_
from_ down - pull_
from_ left - pull_
from_ right - pull_
from_ up - push_
down - push_
left - push_
right - push_up
- smart_
fill - smart_
fill_ glyph - stamp_
clipboard - stamp_
floating - transpose_
selection_ corner