-
Notifications
You must be signed in to change notification settings - Fork 93
Minimap #302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minimap #302
Conversation
This is nearly ready, I've discovered some odd behavior when using the minimap in CodeEdit. I'm going to mark this as a draft again until I can resolve those. |
Looks amazing! Can you also provide a screen recording of scrolling through a long file? Also, does the position update when opening the find panel? |
Yes and yes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, very impressive! I can see a lot of consideration went into this. Great work!
There are just a few minor issues I have noted.
...eEditSourceEditorExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
Outdated
Show resolved
Hide resolved
Example/CodeEditSourceEditorExample/CodeEditSourceEditorExample/Views/ContentView.swift
Show resolved
Hide resolved
Example/CodeEditSourceEditorExample/CodeEditSourceEditorExample/Views/Toolbar.swift
Outdated
Show resolved
Hide resolved
Sources/CodeEditSourceEditor/Controller/TextViewController+FindPanelTarget.swift
Show resolved
Hide resolved
Sources/CodeEditSourceEditor/Controller/TextViewController+LoadView.swift
Outdated
Show resolved
Hide resolved
Alright @austincondiff now that CETV has been updated I think I've corrected everything you commented on. |
Description
Adds a minimap to the editor.
Specific changes:
MinimapView
. This view acts as the container view for the entire minimap contents including the separator, text bubbles, and scroll view.MinimapContentView
Displays the real contents of the minimap. The layout manager and selection manager place views and draw into this view.MinimapLineRenderer
uses the new layout overriding APIs to render small bubbles rather than text for the minimap. This delegates all bubble calculation and drawing to a custom viewMinimapLineFragmentView
.MinimapLineFragmentView
is a subclass ofLineFragmentView
that calculates and draws bubbles instead of text based on the foreground color of the line fragment it displays.showMinimap
parameter toTextViewController
andCodeEditSourceEditor
types.updateContentInsets
updates all relevant content insets for the scroll view, find panel, and minimap in one central place. This method is deterministic and builds on work @austincondiff and I discussed.updateTextInsets
updates the text view's insets.Example app:
Related Issues
Checklist
Screenshots
Demo resizing & toggling minimap with selections being drawn and responding to scrolling.
Screen.Recording.2025-04-17.at.10.19.14.AM.mov
Demo scrolling a long document
minimap-long-demo.mp4
Demo editing text, with selections, dragging, and syntax highlighting. Note that syntax highlights haven't been updated to highlight the entire minimap visible region. That will be done, but adding to this PR I think will complicate this PR too much.
minimap-editing-demo.mp4