Open
Description
This is mostly to keep track of the things I envisioned for the minimap future and making sure @mehcode is aware of them (and if someone wants to help it's a good starting point).
- Variable height lines support: The idea here is to allow minimap's lines to have an arbitrary height. There's at least two use cases for which this change is useful:
- Block decorations support: at the moment, block decorations are totally ignored by the minimap, while it doesn't have any impact on the scrolling part (aside from an offset bug at the beginning this is no longer an issue). But the visible area won't take the block decorations into account. If we had variable height lines it should be possible to add an extra height to the line where the decoration belongs so that the minimap's render reflect what's happening in the editor.
- Line label decorations types: at the beginning of the minimap project I started to work on an extension to display a file's symbols (through CTAGS or whatever), the issue back then was that it's possible for many symbols to start at the same line in the file, so there was a lot of stacking/overlay issues to solve before getting something usable (for an idea of what I had in mind emacs' minimap has something along these lines: http://i.stack.imgur.com/y6rfa.jpg). Back to line label decorations, the idea is to attach a text to a line and have that text rendered above/below the line. By having variable height line we can stack up many label for a single line and still be sure that these decorations won't overlap with other decorations defined on following lines.
- Out of bounds decorations: This one is a bit tricky to explain. The thing is, current decorations are rendered on a per-line basis. As decorations are attached to a marker, an editor text range so to say, we're only rendering the part of the decorations that are on the line we want to redraw (when scrolling, editing a line, etc.). This means that a decoration can't take more vertical space than the marker range it's bound to. Let's say we want to render a dot to pinpoint a location in the file, but we want this dot to have a radius of 8px, as of now, we have to, depending on the current minimap settings, define how many lines are covered, extend the marker range to these lines and then have a decoration rendering routine that is able to adapt to all these elements to only render the correct part of the dot that correspond to the line it was requested to draw. And to have tried already I can affirm this is really tedious. The idea here is to have a new custom decoration type, on their own layer, that provides a box defining the space they use in the minimap. With that box, a new decorations rendering routine will be able to detect which other decorations might be affected by a redraw and to restrict the decoration rendering routine to a specific area through the
clip
method of thecanvas
API.