Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
DOM-based measurements #8811
A Brief Flashback
Over the past month we have evaluated several strategies to attack the problem, among which:
Build the lines inside an
Pros: measurements happen in a separate context, completely decoupled from the current DOM. Some optimization can, therefore, be applied: skinnier DOM, less stylesheet, and so on.
Have a canvas element and use the
Pros: measurements happen in a separate context and the overhead is minimal.
Instead of positioning decorations, cursors, etc. with absolute coordinates, embed them inside each line and let the browser figure out all the metrics.
Pros: no need for measurements and more semantical HTML. In addition, this enriches the power of styling customizations (e.g. the user has the possibility to style a piece of text surrounded by a decoration).
In this PR we have implemented DOM-based measurements. The idea here is to append the real lines to the DOM, measure from them, and render everything else that needs measurements.
Feedback is super welcome and appreciated! Thanks!
Sounds very good! I am testing it with the amazing font PragmataPro.
I highly recommend following the instruction from Laurian that deactivate the ligature on the current line, in order to see exactly on which character the cursor is positioned while moving over a ligature (some ligatures involve 3 characters).
A package could be very useful to manage