UI-tests und fixes aus tests

This commit is contained in:
th committed 2026-04-09 23:21:37 +02:00
1 parent b5e30afd0b
commit 0d494bf507
5 files changed
+244 -4

No files matched your search

+7 -2
View File
@@ -232,7 +232,8 @@ function getMirror() {
mirror.style.paddingRight = cs.paddingRight;
mirror.style.borderLeft = cs.borderLeft;
mirror.style.borderRight = cs.borderRight;
mirror.style.width = body.offsetWidth + 'px';
// Use clientWidth to exclude scrollbar, matching the actual text flow area
mirror.style.width = body.clientWidth + 'px';
return mirror;
}
@@ -260,12 +261,16 @@ function updateGutter() {
sentinel.textContent = '\u200b';
m.appendChild(sentinel);
// Use the first short line's height as the base line height
const baseH = divs[0] ? (divs.length > 1 ? divs[1].offsetTop - divs[0].offsetTop : sentinel.offsetTop - divs[0].offsetTop) : 22;
let html = '';
for (let i = 0; i < divs.length; i++) {
const top = divs[i].offsetTop;
const nextTop = (i + 1 < divs.length) ? divs[i + 1].offsetTop : sentinel.offsetTop;
const h = nextTop - top;
html += `<div style="height:${h}px" class="${i + 1 === active ? 'gutter-active' : ''}">${i + 1}</div>`;
// Outer div: exact height, no line-height influence. Inner span: base line-height so number sits on first line.
html += `<div style="display:block;height:${h}px;line-height:0;overflow:hidden" class="${i + 1 === active ? 'gutter-active' : ''}"><span style="display:inline-block;line-height:${baseH}px">${i + 1}</span></div>`;
}
gutter.innerHTML = html;
currentLine = active;