How to support line wrapping in minimap

Hello,

I’ve been working on a Minimap for CM6: GitHub - replit/codemirror-minimap: Minimap extension for Codemirror 6

One piece of functionality I’ve been working on is supporting line wrapping in the minimap. To do this, I’m currently using a combination of

  • view.viewportLineBlocks to determine the total height of a line (since I can no longer assume a “Line” is just one unit of line height
  • view.moveToLineBoundary to determine the positions within a line that wrap

Both only work within the viewport, and my minimap extends beyond the viewport size, which means this method will not work.

It feels like a bit of a hack, so I hesitate to ask for customizing the viewport size to work around these limitations. It seems like some of the internal view state code could be useful to me too, if it were exposed. Curious if you have any thoughts.

1 Like