Skip to content

Commit 70b66de

Browse files
FredTregsimonbengtsson
authored andcommitted
doc(split): fixing comment on nbsp splitting
1 parent 1962b36 commit 70b66de

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/widthCalculator.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ function calculate(doc: DocHandler, table: Table) {
7878
const padding = cell.padding('horizontal')
7979
cell.contentWidth = getStringWidth(cell.text, cell.styles, doc) + padding
8080

81-
// Using /[^\S\u00A0]+/ instead of \s ensures that we split the text on
82-
// all whitespace except non-breaking spaces (\u00A0). We need to
83-
// preserve them in the split process to ensure correct word separation
84-
// and width calculation.
81+
// Using [^\S\u00A0] instead of \s ensures that we split the text on all
82+
// whitespace except non-breaking spaces (\u00A0). We need to preserve
83+
// them in the split process to ensure correct word separation and width
84+
// calculation.
8585
const longestWordWidth = getStringWidth(
8686
cell.text.join(' ').split(/[^\S\u00A0]+/),
8787
cell.styles,

0 commit comments

Comments
 (0)