line wrap: only decorate lines with indentation
Hunter
Wednesday, August 6th, 2025 at 4:54 PM
467 }
468 }
469
- const offset = Math.min(indented_chars, ARBITRARY_INDENT_LINE_WRAP_LIMIT) * charWidth;
470 + // Only apply decoration to lines that have indentation
471 + if (indented_chars > 0) {
472 + const offset = Math.min(indented_chars, ARBITRARY_INDENT_LINE_WRAP_LIMIT) * charWidth;
473
- 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)');
474 + const rules = document.createElement('span').style;
475 + rules.setProperty('--idented', `${offset}px`);
476 + rules.setProperty('text-indent', 'calc(-1 * var(--idented) - 1px)');
477 + rules.setProperty('padding-left', 'calc(var(--idented) + 6px)');
478
- const linerwapper = Decoration.line({
- attributes: { style: rules.cssText }
- });
479 + const linerwapper = Decoration.line({
480 + attributes: { style: rules.cssText }
481 + });
482
- decorations.push(linerwapper.range(line.from, line.from));
483 + decorations.push(linerwapper.range(line.from, line.from));
484 + }
485 }
486 return Decoration.set(decorations, true);
487 },