Skip to content

Commit d67ba47

Browse files
committed
dont count indentation as part of the length of the line
1 parent d3fe652 commit d67ba47

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

packages/render/src/shared/utils/pretty.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,7 @@ const prettyNodes = (
235235
formatted += node.content;
236236
} else {
237237
const rawText = node.content.replaceAll(/(\r|\n|\r\n)\s*/g, '');
238-
formatted += wrapText(
239-
rawText,
240-
indentation,
241-
maxLineLength - currentIndentationSize,
242-
lineBreak,
243-
);
238+
formatted += wrapText(rawText, indentation, maxLineLength, lineBreak);
244239
}
245240
formatted += lineBreak;
246241
} else if (node.type === 'tag') {
@@ -249,7 +244,7 @@ const prettyNodes = (
249244
.join('');
250245

251246
const rawTagStart = `${indentation}<${node.name}${propertiesRawString}${node.void ? '/' : ''}>`;
252-
if (rawTagStart.length > maxLineLength) {
247+
if (rawTagStart.length - currentIndentationSize > maxLineLength) {
253248
let tagStart = `${indentation}<${node.name}${lineBreak}`;
254249
for (const property of node.properties) {
255250
tagStart += `${indentation} ${property.name}=${property.value}${lineBreak}`;

0 commit comments

Comments
 (0)