Skip to content

Unexpected error: selectionChange: expected cursor but cursor is null. #3942

Closed

Description

@Lgugeng

Description

An unexpected error occurred in the renderer process.

Stack Trace

Error: selectionChange: expected cursor but cursor is null.
    at Rs.getTOC [as selectionChange] (file:///D:/DATA/marktext-1.0beta-win64/resources/app.asar/dist/electron/webpack:/marktext/src/muya/lib/contentState/tableSelectCellsCtrl.js:260:9)
    at Ws.<anonymous> (file:///D:/DATA/marktext-1.0beta-win64/resources/app.asar/dist/electron/webpack:/marktext/src/muya/lib/index.js:111:22)
    at file:///D:/DATA/marktext-1.0beta-win64/resources/app.asar/dist/electron/webpack:/marktext/src/muya/lib/eventHandler/keyboard.js:72:7

Version

MarkText: v0.17.1 (00f5061f)
Operating system: Windows_NT x64 10.0.26100 (win32)

Activity

  1. added
    🐛 bug
    🐞 pri/critical
    🐹 platform/windows
    on May 13, 2026
  2. Jocs commented on May 23, 2026

    @Jocs
    Member

    Closing this with the regression-guard e2e specs added in #4268.

    The selectionChange: expected cursor but cursor is null throw is no longer reachable through the user-action paths that were previously triggering it. The model-cursor fallback at src/muya/lib/contentState/paragraphCtrl.js:18-22 catches the transient DOM-selection-loss case (e.g. another script clearing the selection, blur-during-format).

    Coverage lives in test/e2e/crash-selection-change.spec.ts.

    If you still hit this throw on a recent build, please reopen with the exact MarkText version and reproduction steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐹 platform/windows🐛 bug🐞 pri/critical🔭 area/editor🔭 area/muya

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions