Skip to content

feat(dialog): code-editor caret protocol for cursor-aware completion (0.5.1)#107

Merged
GNERSIS merged 3 commits into
mainfrom
gor/dialog-caret-0.5
May 29, 2026
Merged

feat(dialog): code-editor caret protocol for cursor-aware completion (0.5.1)#107
GNERSIS merged 3 commits into
mainfrom
gor/dialog-caret-0.5

Conversation

@GNERSIS
Copy link
Copy Markdown
Collaborator

@GNERSIS GNERSIS commented May 29, 2026

Summary

Adds an additive code-editor caret channel to the dialog protocol so hosts can
deliver a caret offset alongside code content, and plugins can react to cursor
moves (not just text edits). This is what drives Mosaico's cursor-aware Key/Op/Value
query-assist dropdowns.

  • WidgetEventBuilder::codeChanged(code, cursor = -1) — writes code_cursor when ≥ 0
  • WidgetEvent::codeCursor() — reads it back
  • DialogPluginTyped::onCodeChangedWithCursor(name, code, cursor) — new virtual,
    defaults to onCodeChanged(name, code) (distinct name to avoid
    -Werror=overloaded-virtual); dispatched via event.codeCursor().value_or(-1)
  • WidgetData::setCodeCursor / WidgetDataView::codeCursor — round-trip the caret

All additions are tail-appended / new symbols — no existing struct layout, vtable
slot, or signature changes. PATCH bump 0.5.0 -> 0.5.1 (version synced in
conanfile.py + PJ_PACKAGE_VERSION).

Test plan

  • widget_event_builder_test, widget_event_test, widget_data_test,
    widget_data_view_test, dialog_plugin_typed_test extended + green
  • Conan 0.5.1 release to the remote is intentionally NOT included here — tag
    + publish is a separate, explicitly-authorized step (coordinate w/ Davide).
    Downstream toolbox_mosaico PR feat(pj_base): AssetVideo clip-window (start_ns/end_ns) #97 needs 0.5.1 on the remote to build in CI.

🤖 Generated with Claude Code

GNERSIS and others added 2 commits May 29, 2026 13:43
…5.1)

Re-applies the additive caret protocol (cherry-pick of the 0.4.x change; the
dialog-protocol headers are byte-identical between 0.4.2 and 0.5.0 so it grafts
cleanly): codeChanged(code,cursor) + WidgetEvent::codeCursor;
onCodeChangedWithCursor (distinct-name, defaults to onCodeChanged); setCodeCursor
+ WidgetDataView::codeCursor. Lets a plugin drive caret-aware completion.
Patch bump 0.5.0 -> 0.5.1 (fully additive).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The host emits the caret offset on every cursor move for caret-aware
completion, but firing that for *every* code editor regresses editors that
only validate code (e.g. the reactive-scripts Lua editor re-ran its
validation/terminal logic on each arrow-key press). Make it opt-in:

- WidgetData::setCodeCaretTracking(name, enabled=true) — request cursor-move
  reporting for one editor
- WidgetDataView::codeCaretTracking(name) — host reads the request
- onCodeChangedWithCursor doc clarified: caret is reported (and cursor-only
  moves fire at all) only for opted-in editors; otherwise it's text-change
  only with cursor < 0, i.e. the pre-caret behavior

Folded into the still-unreleased 0.5.1 (additive). Docs updated.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@GNERSIS GNERSIS merged commit 58b259a into main May 29, 2026
4 checks passed
@GNERSIS GNERSIS deleted the gor/dialog-caret-0.5 branch May 29, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants