commit f99bd26e712defdc8f35c0af072b701ce39013bb
parent 7105b71acb35228513bc1ee1535d81d79f47ef14
Author: Hunter
Date: Wed, 6 Aug 2025 16:54:43 -0400
line wrap: only decorate lines with indentation
Diffstat:
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/index.html b/index.html
@@ -467,18 +467,21 @@
}
}
- const offset = Math.min(indented_chars, ARBITRARY_INDENT_LINE_WRAP_LIMIT) * charWidth;
+ // Only apply decoration to lines that have indentation
+ if (indented_chars > 0) {
+ const offset = Math.min(indented_chars, ARBITRARY_INDENT_LINE_WRAP_LIMIT) * charWidth;
- const rules = document.createElement('span').style;
- rules.setProperty('--idented', `${offset}px`);
- rules.setProperty('text-indent', 'calc(-1 * var(--idented) - 1px)');
- rules.setProperty('padding-left', 'calc(var(--idented) + 2px)');
+ const rules = document.createElement('span').style;
+ rules.setProperty('--idented', `${offset}px`);
+ rules.setProperty('text-indent', 'calc(-1 * var(--idented) - 1px)');
+ rules.setProperty('padding-left', 'calc(var(--idented) + 6px)');
- const linerwapper = Decoration.line({
- attributes: { style: rules.cssText }
- });
+ const linerwapper = Decoration.line({
+ attributes: { style: rules.cssText }
+ });
- decorations.push(linerwapper.range(line.from, line.from));
+ decorations.push(linerwapper.range(line.from, line.from));
+ }
}
return Decoration.set(decorations, true);
},