diff --git a/src/widthCalculator.ts b/src/widthCalculator.ts index a59c7df2..e035c15d 100644 --- a/src/widthCalculator.ts +++ b/src/widthCalculator.ts @@ -78,10 +78,10 @@ function calculate(doc: DocHandler, table: Table) { const padding = cell.padding('horizontal') cell.contentWidth = getStringWidth(cell.text, cell.styles, doc) + padding - // Using /[^\S\u00A0]+/ instead of \s ensures that we split the text on - // all whitespace except non-breaking spaces (\u00A0). We need to - // preserve them in the split process to ensure correct word separation - // and width calculation. + // Using [^\S\u00A0] instead of \s ensures that we split the text on all + // whitespace except non-breaking spaces (\u00A0). We need to preserve + // them in the split process to ensure correct word separation and width + // calculation. const longestWordWidth = getStringWidth( cell.text.join(' ').split(/[^\S\u00A0]+/), cell.styles,