Add Emacs-style mark commands (setMark:, selectToMark:, swapWithMark:, deleteToMark:) - #113
Merged
Merged
Conversation
…, deleteToMark:) The kill ring (yank:) is already implemented, but the mark family from NSStandardKeyBindingResponding was missing, so DefaultKeyBinding.dict macros built on setMark:/deleteToMark:/selectToMark: (line moves, paragraph cut/copy) broke mid-chain. deleteToMark: routes through deleteBackward: so the killed text lands in the yank buffer.
Contributor
Author
|
FWIW: the five new MarkTests pass — the macOS failures are in the SizeToFitTests suite, which this PR doesn't touch. |
Owner
|
I wonder why tests started to fail |
Contributor
Author
|
Well, the 2.3.9 and 2.3.10 release pushes failed Tests back in April too (runs 24578356355 / 25106201089), as did an April PR. The last green run on main I can see is from Jan 6. All current failures are SizeToFitTests, i.e. sizeToFit compared against NSTextView metrics, and the macos-15 runner image was refreshed on Jul 15 (version 20260715.0234.1). So this looks like text-metric drift in the runner environment. Running the Tests workflow on main via workflow_dispatch should reproduce it without this PR. |
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.
Problem: The AppKit STTextView implements the kill ring (
yank:) but not the mark family fromNSStandardKeyBindingResponding—setMark:,selectToMark:,swapWithMark:anddeleteToMark:are no-ops. Multi-stepDefaultKeyBinding.dictmacros (line moves, paragraph cut/copy, …) are commonly built on exactly these selectors and break mid-chain.Change: Implements the four selectors in an
STTextView+Markextension, storing the mark as anNSRangenext to_yankingManager.deleteToMark:routes throughdeleteBackward:so the killed text lands in the yank buffer and a followingyank:reinserts it. Stale marks (text edited sincesetMark:) are clamped before use.Tests included. Verified against a real-world binding dictionary: a
^@\UF700move-line-up macro chain (selectParagraph:,setMark:,deleteToMark:, …,yank:,selectToMark:) now behaves the same as in NSTextView.