I think that Editor should have a new public method `getPaddingTop` that would return `editor._getLineSpaceElement().offsetTop`, and replaced `_getLineSpaceElement`. Checking thought the code the only other place where `_getLineSpaceElement()` is used is inside Editor to check the offsetTop, just like I did. Currently `_getLineSpaceElement()` is not public because is really specific to code mirror, but replacing it for `getPaddingTop` would make it less specific and could be changed to any other value if needed, even 0 if the padding would be removed at some point.