Skip to content

[desktop] Review virtual caret robustness gaps#15

Closed
Codex wants to merge 1 commit intosmooth-caretfrom
codex/sub-pr-13
Closed

[desktop] Review virtual caret robustness gaps#15
Codex wants to merge 1 commit intosmooth-caretfrom
codex/sub-pr-13

Conversation

@Codex
Copy link
Contributor

@Codex Codex AI commented Feb 21, 2026

Custom animated caret was added for the ProseMirror editor; review uncovered latent flaws that could break the cursor when multiple editors mount or when the plugin cannot attach its container.

  • Findings

    • Module-scoped caret state (caret.ts caretStyle, activeView, activeEl) ties style updates to the last-mounted editor, so concurrent editors would fight over the cursor.
    • Plugin silently skips caret creation if view.dom lacks a parent, leaving the native cursor hidden and no visible caret.
  • Recommended fixes

    • Scope caret element/state to each plugin instance; persist style per instance from localStorage.
    • Guard parent lookup with a fallback container or skip hiding the native caret when attachment fails; log for diagnostics.
  • Illustrative snippet

    // Current shared state
    let caretStyle: CaretStyle = (localStorage.getItem("cursor") as CaretStyle) ?? "line";
    let activeView: EditorView | null = null;
    let activeEl: HTMLElement | null = null;

@Codex Codex AI changed the title [WIP] Add smooth animated caret with line and underline styles [desktop] Review virtual caret robustness gaps Feb 21, 2026
@Codex Codex AI requested a review from usamaasfar February 21, 2026 18:11
@usamaasfar usamaasfar marked this pull request as ready for review February 21, 2026 18:13
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 21, 2026

No reviewable files after applying ignore patterns.

@usamaasfar usamaasfar closed this Feb 21, 2026
@usamaasfar usamaasfar deleted the codex/sub-pr-13 branch February 21, 2026 18:15
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