Skip to content
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

Custom view for the minimap #92

Open
4 tasks
Tracked by #91
mchakravarty opened this issue Jan 13, 2024 · 0 comments
Open
4 tasks
Tracked by #91

Custom view for the minimap #92

mchakravarty opened this issue Jan 13, 2024 · 0 comments
Labels
advanced Larger effort with open questions architecture Requires changes that affect the general architecture performance Profiling and performance debugging

Comments

@mchakravarty
Copy link
Owner

mchakravarty commented Jan 13, 2024

The current setup for the minimap (where the minimap is a separate text view using a smaller font, but sharing an NSTextStorage with the main code view) has the inherent disadvantage that layout happens twice. This implies twice the work (where layout is the main performance bottleneck already anyway) and it means that we need to carefully set things up, such that the two layouts coincide (especially wrt to line breaks), which turns out to be a rather fragile affair.

A better code architecture would share the layout of the code view with the minimap. This requires the minimap to use a custom view (instead of being a subclass of {NS|UI}TextView). To this end, we need to do the following:

  • CodeView needs to use custom NSTextLineFragments that have a second draw method for drawing to the minimap.
  • The custom minimap view needs to scale everything down (as the layout is in terms of the coordinate system of the code view).

Two challenges are the following:

  • It seems hard to replace the view port manager in the standard {NS|UI}TextView set up (judging from earlier experiments, where it seemed to use some undocumented functionality), but that is necessary as the view port needs to include the entire region displayed by the minimap and not only the portion visible in the code view.
  • We want to be able to deviate from the layout of the code view in the minimap for things such as the documentation headers. Is that even possible in such a set up?
@mchakravarty mchakravarty mentioned this issue Jan 13, 2024
2 tasks
@mchakravarty mchakravarty added performance Profiling and performance debugging advanced Larger effort with open questions architecture Requires changes that affect the general architecture labels Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
advanced Larger effort with open questions architecture Requires changes that affect the general architecture performance Profiling and performance debugging
Projects
None yet
Development

No branches or pull requests

1 participant