Merge pull request #3048 from danfuzz/fix-first-line-margin-top

Account for any top margin on the first line.
This commit is contained in:
Luiza Pagliari 2016-09-08 05:59:36 -03:00 committed by GitHub
commit 5022912895
1 changed files with 10 additions and 1 deletions

View File

@ -5459,7 +5459,16 @@ function Ace2Inner(){
// and the line-numbers don't line up unless we pay
// attention to where the divs are actually placed...
// (also: padding on TTs/SPANs in IE...)
h = b.nextSibling.offsetTop - b.offsetTop;
if (b === doc.body.firstChild) {
// It's the first line. For line number alignment purposes, its
// height is taken to be the top offset of the next line. If we
// didn't do this special case, we would miss out on any top margin
// included on the first line. The default stylesheet doesn't add
// extra margins, but plugins might.
h = b.nextSibling.offsetTop;
} else {
h = b.nextSibling.offsetTop - b.offsetTop;
}
}
if (h)
{