Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions src/lib/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,13 @@ For example:

const { line, column } = getLineAndColumn(index);

const editorStyle = getComputedStyle(editor);
const paddingLeft = parseFloat(editorStyle.paddingLeft) || 8;
const paddingTop = parseFloat(editorStyle.paddingTop) || 1;

const characterOffset = 1.0;

// Highlights live inside the overlay's content box, whose padding matches
// the textarea's padding exactly (see .highlight-overlay / .editor-textarea
// in main.scss). So positions are pure content-box coordinates — the shared
// padding already aligns them with the text; adding it here would double-count.
return {
left:
(column - 1) * charWidth + paddingLeft - characterOffset * charWidth,
top: (line - 1) * lineHeight + paddingTop,
left: (column - 1) * charWidth,
top: (line - 1) * lineHeight,
width: length * charWidth,
height: lineHeight,
};
Expand Down
2 changes: 1 addition & 1 deletion src/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ main {
bottom: 0;
pointer-events: none;
overflow: auto;
padding: 0 10px;
padding: 0 12px;
padding-top: 1px;
box-sizing: border-box;
white-space: pre;
Expand Down
Loading