Wire Win32 pressure into Dart, tighten pinch guards, use geometric shape
strokes, expand the ink palette, and replace scratch-link split view with
an on-page sticky that shares the sidecar repo.
Co-authored-by: Cursor <cursoragent@cursor.com>
Search now covers handwriting, the PDF text layer, AND scanned
(rasterized) PDFs.
- PdfTextIndexer runs at import: sums the embedded text layer across
pages; if present it stores that as the document body, otherwise the
PDF is rasterized and its rendered pages are OCR'd in the background.
The result lands in the sidecar `pageText` field (distinct from
`ocrText`, the handwriting OCR). Idempotent (skips a sidecar that
already has pageText); degrades gracefully with no OCR engine.
- pdfrx_page_text_source abstracts text/render so it's testable.
- VaultSearchIndex now harvests title + typed text + handwriting OCR +
PDF pageText, so search finds notes, typed PDFs and scanned PDFs.
analyze clean, 409 tests green.
Add a text-annotation tool to the PDF editor. With the text tool a
pen-tap, or a mouse double-click, drops a text box at that normalized
page point and focuses a real Flutter TextField — so the OS IME and the
Windows-Ink handwriting panel feed it (device-validated). Tapping an
existing box re-opens it; clearing it deletes it.
- SidecarText {nx, ny, text, fontSize (page-relative), color} per page,
glued under zoom; stored in the sidecar `texts` field (back-compat
missing -> none), saved via scheduleTextsSave and loaded on open.
- Rendered in pageOverlaysBuilder at the scaled position.
PDF editor only for now (note text later). analyze clean, 397 tests.
Add a bookmark tool to the PDF editor. A bookmark anchors to a precise
location: when text is selected it captures the selection's normalized
rect + the start char index in the page text (the true paragraph
anchor); with no selection it falls back to the tapped page + point.
- Bookmark model gains optional normalized anchor rect + charIndex +
label (all absent from JSON when null, so old sidecars still load).
- Bookmarks persist in the sidecar (scheduleBookmarkUpsert) and load on
open; a bookmarks panel lists them and tapping one jumps to its page.
Delete is persisted.
Scoped to the PDF editor (note bookmarks later); scroll-to-anchor is
page-level for now. analyze clean, 391 tests green.
A blank note can show a page-background template painted behind the
ink, picked from the toolbar and persisted per notebook.
- NoteBackground: blank / dots / ruled / grid / cornell, drawn in
page space (scales with zoom), subtle grey. Cornell = left margin +
bottom summary rule over a ruled body.
- Stored as the enum name in the notebook sidecar (back-compat:
missing/unknown -> blank), saved/loaded via SidecarRepository so it
restores on reopen.
- Picker added to the note tool palette.
PDF backgrounds skipped (PDFs have their own page content). analyze
clean, 386 tests green.
Phase 6 (final storage phase).
- SidecarRepositoryRegistry tracks every open repo; SidecarFlushObserver
(a WidgetsBindingObserver in main) flushes them all on
inactive/hidden/paused/detached, awaiting each flush — the last
strokes can't be lost on app close, not just on the 800ms timer.
- VaultSearchIndex rebuilds by scanning vault sidecars (the source of
truth) — note titles, OCR text and document names — and search_provider
queries it, so search spans notes + PDFs. Rebuilt on launch / after
import.
The vault file-based storage migration (Phases 0-6) is complete:
annotations travel with the file, picked vault folder, atomic autosave,
one Import-file entry, SQLite migrated to sidecars. analyze clean,
tests green.
Phase 4. Standalone notes move off SQLite into the vault, like the
PDF annotations.
- "Create notebook" makes a vault folder with a notebook.badnote.json
(BadnoteSidecar docType 'notebook' + a title field), opened via
SidecarRepository.
- PenNoteScreen loads/saves its strokes (page 0) + title to that
sidecar instead of the SQLite Note model.
- note_provider lists notes from a vault scan (VaultService.scanNotes
= folders with notebook.badnote.json and no source file); the doc
scan still excludes them. Delete removes the folder.
PDF/slide editors unchanged; pre-existing SQLite notes migrate in
Phase 5. analyze clean, tests green.
Phase 2 (core swap). The PDF editor and split-view scratchpad stop
writing SQLite and persist to a per-file sidecar
`<pdfPath>.badnote.json` (debounced, atomic temp+rename+.bak) — so
annotations travel with the file. The source path is the identity
(no more djb2 doc-id).
- SidecarRepository wraps the Phase-1 store with debounced autosave.
- pen_editor: per-page ink, scratch-links AND highlights now persist
to the sidecar and restore on reopen (closes persist-highlights).
- New "un-highlight" tool: tap a stored highlight to remove it — the
highlight could not be removed before.
- split_view: each anchor's scratchpad lives in the sidecar's
scratchLinks[id].scratchpad, keyed by anchor id.
Note: pre-existing SQLite annotations are migrated later (Phase 5);
note/slide editors swap in Phase 4. analyze clean, tests green.