Repository navigation
Size the mark that is selected, and let a caption be reopened - #16
Merged
Merged
Conversation
Three things about editing a caption, and about what the wheel is changing. ⇧⏎ and ⌥⏎ were meant to break the line, but a text view sends both plain ⏎ and ⇧⏎ as `insertNewline`, so ⇧⏎ finished the snip instead. The modifiers decide now. The wheel used to follow "whatever was drawn last", so starting a new caption and scrolling resized the previous one. A mark is now selected — by being drawn, or by being clicked — and the size controls act on the selection; with nothing selected they set the value for the next mark. While a caption is being typed that box counts as the selection, and its own type grows with the wheel. A caption can also be reopened: double-click it to edit its words, drag it to move it, ⌫ to delete the selected mark. Re-editing writes back to the same mark instead of leaving a second copy beside it.
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.
Three problems, two of them mine from the last round.
1. ⇧⏎ finished the snip instead of breaking the line
NSTextViewsends both plain ⏎ and ⇧⏎ asinsertNewline, so the "⇧⏎ inserts a line break" branch never ran. The modifier flags decide now; ⌥⏎ works the same way.2. The wheel resized the wrong mark
It followed "whatever was drawn last", so opening a new caption and scrolling resized the previous one. That was a bad rule:
[],− 粗细 N +) act on the selection.The selected mark is outlined in dashes so it is clear what the wheel will change.
3. A caption could not be edited again
Double-click a caption to reopen it for editing; the words go back into the same mark rather than leaving a duplicate beside it. Drag still moves it, and ⌫ deletes the selected mark.
Verification
原始文字(改过)Driving this through synthesised events needs
mouseEventClickStateset to get a real double-click; otherwiseclickCountis always 1, which is why an earlier attempt looked like the feature did not work. Thetype:debug command now also writes straight into the open caption, because focus-stealing is refused while another app is in front.