@drghaliasri/butex 7.4.0 → 7.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5378,6 +5378,8 @@ function setCurrentDigitForm(session, digitForm) {
5378
5378
  return next;
5379
5379
  }
5380
5380
  function insertChar(session, expr) {
5381
+ const digit = formatDigits(expr, "western");
5382
+ if (/^[0-9]$/.test(digit)) return insertNumber(session, digit);
5381
5383
  const base = replaceSelectionFirst(session);
5382
5384
  if (!base.splitLeafTyping && !base.forceSplitNextLeaf) {
5383
5385
  const next = cloneEditorSession(base);
@@ -5393,17 +5395,18 @@ function insertChar(session, expr) {
5393
5395
  return inserted;
5394
5396
  }
5395
5397
  function insertNumber(session, expr) {
5398
+ const digit = formatDigits(expr, "western");
5396
5399
  const base = replaceSelectionFirst(session);
5397
5400
  if (!base.splitLeafTyping && !base.forceSplitNextLeaf) {
5398
5401
  const next = cloneEditorSession(base);
5399
- if (tryMergeLeafTyping(next, "number", expr)) {
5402
+ if (tryMergeLeafTyping(next, "number", digit)) {
5400
5403
  next.selectedStructureNodeId = null;
5401
5404
  syncSelectionToCaret(next);
5402
5405
  appendDebug(next, "mergeLeaf", `number:${expr}`);
5403
5406
  return next;
5404
5407
  }
5405
5408
  }
5406
- const inserted = insertLeaf(base, "number", expr);
5409
+ const inserted = insertLeaf(base, "number", digit);
5407
5410
  inserted.forceSplitNextLeaf = false;
5408
5411
  return inserted;
5409
5412
  }