From 92db878ba529ee1777e4530b3c8d79c5c107660c Mon Sep 17 00:00:00 2001 From: Adam Harris Date: Wed, 21 Oct 2026 01:01:55 -0600 Subject: [PATCH 1/2] test(tui): a copy with no pasteboard still proves ^c reached the clipboard verb the_bar_hands_the_host_s_own_chords_back_to_the_host required the status "copied", so it failed on any machine without a pasteboard (a headless Linux box), where clipboard_copy reports "clipboard unavailable". Either report means ^c reached the verb rather than being swallowed by the find bar, which is what the test is about; the other clipboard tests already skip when there is no pasteboard. --- apps/leaf-tui/src/main.rs | 14 ++++++++---- docs/tasks/closed/closed.md | 1 + docs/tasks/{ => closed}/heading-at-offset.md | 24 +++++++++++--------- docs/tasks/tasks.md | 1 - 4 files changed, 23 insertions(+), 17 deletions(-) rename docs/tasks/{ => closed}/heading-at-offset.md (69%) diff --git a/apps/leaf-tui/src/main.rs b/apps/leaf-tui/src/main.rs index 912c7821..2203d357 100644 --- a/apps/leaf-tui/src/main.rs +++ b/apps/leaf-tui/src/main.rs @@ -3511,14 +3511,18 @@ mod tests { // status is the assertion rather than the pasteboard itself: `^c` with // the bar up used to be swallowed, and "copied" is exactly the report // that it no longer is. What lands on the pasteboard is - // `copy_publishes_both_flavors`' business. + // `copy_publishes_both_flavors`' business. Where there is no + // pasteboard (a headless Linux box) the verb still runs, and says so. assert_eq!(doc.selected_text(), Some("needle")); handle_key(&mut doc, ctrl('c'), &mut app); assert!(app.find.is_some(), "the bar stays up over a copy"); - assert_eq!( - doc.status.as_deref().map(|s| s == "copied"), - Some(true), - "^c must reach the host's clipboard verb, not be eaten by the bar" + assert!( + matches!( + doc.status.as_deref(), + Some("copied" | "clipboard unavailable") + ), + "^c must reach the host's clipboard verb, not be eaten by the bar: {:?}", + doc.status ); // ^P closes the bar first: the palette can run an editing command over diff --git a/docs/tasks/closed/closed.md b/docs/tasks/closed/closed.md index e768fcc6..819b0ce7 100644 --- a/docs/tasks/closed/closed.md +++ b/docs/tasks/closed/closed.md @@ -36,6 +36,7 @@ contents: - '[Following a fragment lands before its heading](/docs/tasks/closed/fragment-lands-before-heading.md)' - '[Split leaf-dioxus into a widget crate and its app](/docs/tasks/closed/split-leaf-dioxus-into-a-widget-crate-and-its-app.md)' - '[Place the Dioxus editor in part of a window](/docs/tasks/closed/place-the-dioxus-editor-in-part-of-a-window.md)' +- '[Heading At Offset](/docs/tasks/closed/heading-at-offset.md)' --- # Closed tasks diff --git a/docs/tasks/heading-at-offset.md b/docs/tasks/closed/heading-at-offset.md similarity index 69% rename from docs/tasks/heading-at-offset.md rename to docs/tasks/closed/heading-at-offset.md index 73107d9c..06369eb0 100644 --- a/docs/tasks/heading-at-offset.md +++ b/docs/tasks/closed/heading-at-offset.md @@ -1,19 +1,21 @@ --- -status: open +status: done created: 2026-09-16 -updated: 2026-10-06 -part_of: '[Tasks](/docs/tasks/tasks.md)' +updated: 2026-10-21 +part_of: '[Closed tasks](/docs/tasks/closed/closed.md)' --- # The heading the caret is under is a question `Doc` cannot answer -**Status.** Open: the leaf half is in, provui's is not. `feat(core): -heading_at — the heading a place in the document is under` adds -`Doc::heading_at` / `heading_at_caret` and the `Heading` type, in the shape -below, and exposes both through leaf-ffi and the wasm binding as a -`HeadingView` (`text`, `level`, `start`, `end`). What remains is provui's, -and it waits on nothing now: provui takes leaf from git, and its lock -(`17dd988`, 2026-10-06) already carries `heading_at`. `DocumentSession::heading_at_caret` -delegates to leaf, and `twig` leaves `provui-core`'s manifest. +**Status: done.** The leaf half is `feat(core): heading_at — the heading a +place in the document is under` (`d15bbb7`), which adds `Doc::heading_at` / +`heading_at_caret` and the `Heading` type, in the shape below, and exposes +both through leaf-ffi and the wasm binding as a `HeadingView` (`text`, +`level`, `start`, `end`); `heading_at_caret_is_the_nearest_heading_above` in +`doc/tests/links.rs` is the test the done-when asks for. provui's half is +`refactor(core)!: ask leaf for the heading under the caret instead of parsing +the body again` (provui `d512e25`, diaryx-org/provui#5): +`DocumentSession::heading_at_caret` delegates to leaf, and `twig` has left +`provui-core`'s manifest. **Where.** `crates/leaf-core/src/doc/under_caret.rs`, beside `link_destination_at_caret` and `locate`. diff --git a/docs/tasks/tasks.md b/docs/tasks/tasks.md index 4db1ee7a..14e5fcd1 100644 --- a/docs/tasks/tasks.md +++ b/docs/tasks/tasks.md @@ -6,7 +6,6 @@ updated: 2026-10-04 contents: - '[Writing Tools in the Apple views](writing-tools.md)' - '[Right-to-left text](right-to-left-text.md)' -- '[The heading the caret is under is a question `Doc` cannot answer](heading-at-offset.md)' - '[`can_undo` counts edits, and twig counts steps](can-undo-counts-edits-not-steps.md)' - '[The Mac app runs unsandboxed](sandboxed-mac-app.md)' - '[Enter in an HTML document writes whitespace](enter-in-html-writes-whitespace.md)' From 3b24dc0a7a4ba3175fb38b84921f9adac44ca9cb Mon Sep 17 00:00:00 2001 From: Adam Harris Date: Wed, 21 Oct 2026 01:01:55 -0600 Subject: [PATCH 2/2] docs(tasks): close heading-at-offset, whose provui half landed in provui#5 provui d512e25 has DocumentSession::heading_at_caret delegate to leaf's Doc::heading_at_caret and takes twig out of provui-core's manifest, the last of the task's done-when. Shelved into docs/tasks/closed with prov. --- docs/tasks/closed/closed.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tasks/closed/closed.md b/docs/tasks/closed/closed.md index 819b0ce7..b37c256e 100644 --- a/docs/tasks/closed/closed.md +++ b/docs/tasks/closed/closed.md @@ -36,7 +36,7 @@ contents: - '[Following a fragment lands before its heading](/docs/tasks/closed/fragment-lands-before-heading.md)' - '[Split leaf-dioxus into a widget crate and its app](/docs/tasks/closed/split-leaf-dioxus-into-a-widget-crate-and-its-app.md)' - '[Place the Dioxus editor in part of a window](/docs/tasks/closed/place-the-dioxus-editor-in-part-of-a-window.md)' -- '[Heading At Offset](/docs/tasks/closed/heading-at-offset.md)' +- '[The heading the caret is under is a question `Doc` cannot answer](/docs/tasks/closed/heading-at-offset.md)' --- # Closed tasks