Repository navigation
v0.2.13
A shared Document under several editors, each with its own caret, menus and scroll. Anchors in markdown byte offsets, placed down the page whether built or not, with hover events and app washes beside them. Keyed context menus that stand off a trigger and walk submenus by arrow key. A source view that keeps its lines across frames and highlights edits off the UI thread.
New
Document, a markdown document as its editors share it: the text, its form, its marks, its anchors and one undo stack.Editor::for_documentopens an editor on one, and every editor on it shows the same text with its own caret and scroll.Editor::documentis the one an editor is on;Editor::newstill makes an editor on a document of its own.DocumentEventreports a change to a document, andDocumentEvent::editedwhether its text changed.Document::source_with_anchorsanswers the markdown to save and each anchor's range in byte offsets into it (SourceRanges), andDocument::set_source_anchorstakes ranges in byte offsets into the markdown the document was read from.Editor::anchor_topsplaces every anchor down the editor, built or not: an anchor whose line has not been built gets its block's top, guessed until the block is measured.BlockLayouts::topplaces any position the same way.Editor::set_washeswashes ranges the app sets, such as find hits, over the anchors' own, andEditor::washesreads them back.EditorEvent::AnchorHoveredsays which anchor's text the pointer came over, orNonewhen it leaves one.Editor::source_linescounts the source's lines in source mode.markdown::SourceTextholds a source text's lines and highlight spans across frames.SourceText::editredoes only the lines an edit touched and answers aSpanJob, which highlights the whole text on any thread forSourceText::set_spans.ContextMenuis keyed by aKand stands at aPlace: a window point, or above or below a trigger with either edge aligned.ContextMenu::toggleopens or closes the menu a trigger owns,ContextMenu::triggerwraps the trigger, andkey,showing,card,placeandrender_forread and draw it.- A context menu walks into a submenu with the right arrow and back out with the left (
menu::SelectChild,SelectParent). History::clear,History::can_undo, andRun, the run of edits an undo step coalesces.
Changed
with_undo_limit,with_marks,with_mode,set_anchors,source_with_anchorsandset_source_anchorsare onDocument, notEditor.ContextMenuisContextMenu<V, K = ()>, andSlotisSlot<V, K>.ContextMenu::opentakes the key, aPlaceand the choice handler;renderno longer takes the handler.History::landedandinterruptare onRun.markdown::render_sourcetakes a&SourceTextinstead of a&str.- Source mode applies an edit to the lines it touched and highlights it on the background executor, showing the spans from before the edit until then.
Fixed
- Lifting custom marks out of markdown is linear in the source again, instead of quadratic in its code spans, fences and links.