Repository navigation
Conversation
A caret move invalidated the text view's bounds, the statement band's change redrew the whole view, and the gutter redrew every row on each selection change and edit. Now the selection manager invalidates the lines the selections left and the lines they are on, the band invalidates its old and new lines and draws only the lines in the dirty rect, and the gutter redraws the selection's old and new rows and, on an edit, the edited line or every line below it when lines move. The gutter's caret band is tested against the dirty rect instead of the visible text, selected line numbers after Select All come from the drawn lines only, and shaped line numbers are cached by number and colour. Fixes `didUpdate || reposition(...)`, which stopped repositioning carets after the first one that moved.
This branch has not been deployed
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
NSTextViewredraws only the lines an insertion point leaves and enters, instead ofsetNeedsDisplay(bounds). A draw pass records where it put the selections, so a layout pass that moved their lines is still covered on the next move. An edit invalidates the selections too, which a text view that is not first responder used to skip.didUpdate = didUpdate || repositionCursorSelection(...)stopped repositioning carets after the first one that moved, so with several carets the later ones stayed where they were.Measured in the unit tests (900 x 6,000 pt view, 14 pt monospaced):
CTLines created per gutter drawLeft for a follow-up, in the issue comment: dropping the gutter redraw on each scroll frame, and the 50 ms synthetic frame-change notification after an edit.
Test plan
SelectionBehaviourTests: a caret move from line 1 to line 201 invalidates only rects one line high, covering both lines (fails on main, which invalidates the bounds); several carets moved together each land on their new offset (fails on main).GutterHighlightTests: a ranged selection marks only the lines inside the drawn range.verify.sh package TableProEditor, the whole package: 931 passed (TableProTextEngineTests 477, TableProEditorKitTests 454).Closes #4536