Word wrapping line widgets

First off, thanks for CodeMirror it’s one of the best open-source projects around. I’m constantly pushing my manager to support this project. :smile:

I searched around the site for this issue but didn’t see anything relating to line widgets.

https://github.com/digitalreasoning/AnnoMirror (Refer to the picture in the readme)

In that project ^^ i’m using line widgets to display annotations above certain character offsets. Now if I enable line wrapping i’m seeing that the line widget stays above the line even if it’s wrapped.

Therefore i’m curious how difficult would it be for me to implement a solution that allows a line widget to remain above it’s portion of the wrapped line. To clarify in the picture, I want the VBG annotation to display below “alice” but above “sitting”. If anyone has any insight or better idea how to solve this problem please let me know.

Thanks again!

This would, unfortunately, be really hard. Line widgets are laid out as simple blocks between the lines. CodeMirror just lets the browser handle the wrapping inside of a line, and stays out of the way.

You could do something with setting a large line-height to reserve space, and then overlaying your widgets on the editor, but that’d make you responsible for repositioning them every time something changes, so that’s somewhat awkward as well.

Thanks Marjin, I appreciate the quick response.