Browse Source

Tweak comment

pull/1072/head
Tatsunori Uchino 6 months ago
parent
commit
e2d36b56ef
  1. 5
      lib/rules_inline/state_inline.mjs

5
lib/rules_inline/state_inline.mjs

@ -119,10 +119,11 @@ StateInline.prototype.scanDelims = function (start, canSplitWord) {
// treat beginning of the line as a whitespace
if (pos <= 0) { return 0x20 }
const charCode = str.charCodeAt(pos - 1)
// not low surrogates (BMP)
// not a low-surrogate code unit (is BMP code point)
if ((charCode & 0xFC00) !== 0xDC00) { return charCode }
// undefined if out of range (leading stray low surrogates)
// undefined if out of range (typically due to isolated low-surrogate code unit
// at the beginning of the string)
const codePoint = str.codePointAt(pos - 2)
// undefined > 0xffff = false, so we don't need extra check here
return codePoint > 0xffff ? codePoint : charCode

Loading…
Cancel
Save