From 376bac7195bf2114da8b234ffa64af9751b4466d Mon Sep 17 00:00:00 2001 From: StefanVukovic99 Date: Mon, 5 Feb 2024 13:09:22 +0100 Subject: ignore soft hyphen when scanning text (#640) * add soft hyphen to ignored characters * add soft hyphen to ignored characters --- ext/js/dom/dom-text-scanner.js | 1 + ext/js/dom/text-source-element.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ext/js/dom/dom-text-scanner.js b/ext/js/dom/dom-text-scanner.js index 5caa32f7..f1dc3661 100644 --- a/ext/js/dom/dom-text-scanner.js +++ b/ext/js/dom/dom-text-scanner.js @@ -472,6 +472,7 @@ export class DOMTextScanner { return preserveNewlines ? 3 : 1; case 0x200b: // Zero-width space case 0x200c: // Zero-width non-joiner + case 0x00ad: // Soft hyphen return 0; default: // Other return 2; diff --git a/ext/js/dom/text-source-element.js b/ext/js/dom/text-source-element.js index 8727a4e1..927783d1 100644 --- a/ext/js/dom/text-source-element.js +++ b/ext/js/dom/text-source-element.js @@ -246,8 +246,8 @@ export class TextSourceElement { break; } - // Remove zero-width space and zero-width non-joiner - content = content.replace(/[\u200b\u200c]/g, ''); + // Remove zero-width space, zero-width non-joiner, soft hyphen + content = content.replace(/[\u200b\u200c\u00ad]/g, ''); return content; } -- cgit v1.2.3