Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/textkit/src/engines/linebreaker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import advanceWidthBetween from '../../attributedString/advanceWidthBetween';
* @typedef {import('../../types.js').Attributes} Attributes
*/

const HYPHEN = 0x002d;
const HYPHEN = '-';
const TOLERANCE_STEPS = 5;
const TOLERANCE_LIMIT = 50;

Expand Down Expand Up @@ -43,7 +43,9 @@ const breakLines = (string, nodes, breaks) => {
end = prevNode.value.end;

line = slice(start, end, string);
line = insertGlyph(line.length, HYPHEN, line);
if (!line.string?.endsWith(HYPHEN)) {
line = insertGlyph(line.length, HYPHEN.charCodeAt(0), line);
}
} else {
end = node.value.end;
line = slice(start, end, string);
Expand Down