Skip to content

Commit

Permalink
doc(split): fixing comment on nbsp splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
FredTreg authored and simonbengtsson committed Oct 15, 2024
1 parent 1962b36 commit 70b66de
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/widthCalculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 70b66de

Please sign in to comment.