feat: the clock of the Android editor moves the shard at the cursor to now #342

Merged
kfickel merged 4 commits from 340_clock-moves-shard-to-now into main 2026-10-26 23:06:54 +01:00
Collaborator

Closes #340.

The clock in the bar above the keyboard used to insert @HHMMSS at the cursor. Now it moves the shard the cursor is in to now.

Behaviour

  • Which line: the line of the innermost shard at the cursor. Untagged headings are not shards in the parser; they become one only once they carry a marker. So if there is a heading between that shard's first line and the cursor, the nearest such heading is used.
  • What it changes: the shard's own date and time markers (@HHMMSS, @YYYYMMDD, @YYYYMMDDHHMMSS) are removed. In their place go the markers it needs to read as now, relative to what it inherits, via moment_markers, the same as append. That gives @HHMMSS, or @YYYYMMDD @HHMMSS on another day, and always at least the time.
    • Example: # @124000 Call at 13:00 becomes # @130000 Call.
  • Where they go: where the first removed marker was. Otherwise after the other markers, otherwise after the # or list mark.
  • Check after the edit: the text is parsed again with the change. If the shard would not read as now after all (marking a heading can split the file anew), it gets the full date and time.
  • Already at now: a shard that already reads as now is left alone.
  • Fallback: an unmarked shard on line 1 would make its markers the whole file's. In that case, and when a shard's markers are not on its line, the markers go in at the cursor as before. The same happens while the stream is not read.
  • Typing meanwhile: if the text changed while the core was asked, nothing is applied.

Changes

  • Core: document/moment.rs has move_to_now, which returns a MomentEdit: Line with the new cursor, AtCursor, or Unchanged. It is also on the facade as api::move_to_now. 18 tests cover headings, list items, nesting, inherited dates, a DST gap, undated files, the line-1 fallback and the re-check.
  • FFI: project.moveToNow(text, fileName, offset, now), which converts byte offsets to UTF-16 units of the Kotlin string. The test uses non-ASCII text and an emoji.
  • App: a plain MomentChange and Capturing.moveToNow, implemented by CaptureAdapter and StreamSession. Typed.applying in Editing.kt applies it and has unit tests. The tool label is now "Move to now".
  • Docs: REQUIREMENTS.md, README.md and AGENTS.md are updated.

Checks

  • nix flake check passes.
  • nix build .#streamd-app passes, with the unit and screenshot tests. The screenshots are unchanged, since the label is only a content description.
Closes #340. The clock in the bar above the keyboard used to insert `@HHMMSS` at the cursor. Now it moves the shard the cursor is in to now. ## Behaviour - **Which line:** the line of the innermost shard at the cursor. Untagged headings are not shards in the parser; they become one only once they carry a marker. So if there is a heading between that shard's first line and the cursor, the nearest such heading is used. - **What it changes:** the shard's own date and time markers (`@HHMMSS`, `@YYYYMMDD`, `@YYYYMMDDHHMMSS`) are removed. In their place go the markers it needs to read as now, relative to what it inherits, via `moment_markers`, the same as `append`. That gives `@HHMMSS`, or `@YYYYMMDD @HHMMSS` on another day, and always at least the time. - Example: `# @124000 Call` at 13:00 becomes `# @130000 Call`. - **Where they go:** where the first removed marker was. Otherwise after the other markers, otherwise after the `#` or list mark. - **Check after the edit:** the text is parsed again with the change. If the shard would not read as now after all (marking a heading can split the file anew), it gets the full date and time. - **Already at now:** a shard that already reads as now is left alone. - **Fallback:** an unmarked shard on line 1 would make its markers the whole file's. In that case, and when a shard's markers are not on its line, the markers go in at the cursor as before. The same happens while the stream is not read. - **Typing meanwhile:** if the text changed while the core was asked, nothing is applied. ## Changes - **Core:** `document/moment.rs` has `move_to_now`, which returns a `MomentEdit`: `Line` with the new cursor, `AtCursor`, or `Unchanged`. It is also on the facade as `api::move_to_now`. 18 tests cover headings, list items, nesting, inherited dates, a DST gap, undated files, the line-1 fallback and the re-check. - **FFI:** `project.moveToNow(text, fileName, offset, now)`, which converts byte offsets to UTF-16 units of the Kotlin string. The test uses non-ASCII text and an emoji. - **App:** a plain `MomentChange` and `Capturing.moveToNow`, implemented by `CaptureAdapter` and `StreamSession`. `Typed.applying` in `Editing.kt` applies it and has unit tests. The tool label is now "Move to now". - **Docs:** REQUIREMENTS.md, README.md and AGENTS.md are updated. ## Checks - `nix flake check` passes. - `nix build .#streamd-app` passes, with the unit and screenshot tests. The screenshots are unchanged, since the label is only a content description.
docs: the clock of the editor moves a shard to now
All checks were successful
Continuous Integration / Lint, Check & Test (push) Successful in 10m46s
Continuous Integration / Conventional Commits (push) Successful in 17s
Continuous Integration / Build Package (push) Successful in 32m7s
2fa20d8650
kfickel deleted branch 340_clock-moves-shard-to-now 2026-10-26 23:06:55 +01:00
Sign in to join this conversation.
No reviewers
No labels
android
cli
epic
planned
tui
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
kfickel/streamd!342
No description provided.