@drghaliasri/butex 7.3.6 → 7.4.1

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.
@@ -4456,6 +4456,8 @@ function setCurrentDigitForm(session, digitForm) {
4456
4456
  return next;
4457
4457
  }
4458
4458
  function insertChar(session, expr) {
4459
+ const digit = formatDigits(expr, "western");
4460
+ if (/^[0-9]$/.test(digit)) return insertNumber(session, digit);
4459
4461
  const base = replaceSelectionFirst(session);
4460
4462
  if (!base.splitLeafTyping && !base.forceSplitNextLeaf) {
4461
4463
  const next = cloneEditorSession(base);
@@ -4471,17 +4473,18 @@ function insertChar(session, expr) {
4471
4473
  return inserted;
4472
4474
  }
4473
4475
  function insertNumber(session, expr) {
4476
+ const digit = formatDigits(expr, "western");
4474
4477
  const base = replaceSelectionFirst(session);
4475
4478
  if (!base.splitLeafTyping && !base.forceSplitNextLeaf) {
4476
4479
  const next = cloneEditorSession(base);
4477
- if (tryMergeLeafTyping(next, "number", expr)) {
4480
+ if (tryMergeLeafTyping(next, "number", digit)) {
4478
4481
  next.selectedStructureNodeId = null;
4479
4482
  syncSelectionToCaret(next);
4480
4483
  appendDebug(next, "mergeLeaf", `number:${expr}`);
4481
4484
  return next;
4482
4485
  }
4483
4486
  }
4484
- const inserted = insertLeaf(base, "number", expr);
4487
+ const inserted = insertLeaf(base, "number", digit);
4485
4488
  inserted.forceSplitNextLeaf = false;
4486
4489
  return inserted;
4487
4490
  }