Decouple isSelectable from isEditable in NativeTextViewWrapper#32
Merged
luca-chen198 merged 2 commits intoMay 21, 2026
Merged
Conversation
Setting `isEditable: false` previously also forced `isSelectable = false` on the underlying NSTextView, which makes NSTextView skip link hit-testing and disables text selection. Read-only markdown views could not open URLs in the browser, fire `onLinkClick` for wiki links, or copy text. `isSelectable` is now always true; `isEditable` controls only the caret and editing, as documented. Fixes nodes-app#31. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
|
I will review it today. Thx |
Read-only mode (isEditable: false) hides the caret but NSTextView still updates selectedRange on click. The engine's active-token logic was caret-driven, so clicking a heading / code / task / HR line still revealed its raw markdown syntax — half-read-only. - `computeActiveTokenIndices` gains a `suppressed: Bool = false` flag; when true it returns an empty set - The 5 coordinator call sites pass `suppressed: !textView.isEditable` - Styling calls forward `caretLocation: -1` when read-only so the two paths that bypass activeTokenIndices (task-checkbox reveal, HR-line-caret reveal) also stay silent Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
textView.isSelectable = trueregardless ofisEditable, soisEditable: falseno longer silently disables link hit-testing and text selection.isEditablenow controls only the caret and editing, matching the DocC contract ("renders read-only with no caret").Fixes #31.
Test plan
swift buildgreenswift testgreenNativeTextViewWrapper(text:, isEditable: false)with a[text](url)link opens the URL in the default browser on click[[Name]]wiki link in read-only mode firesonLinkClick🤖 Generated with Claude Code