@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.
@@ -4485,6 +4485,8 @@ function setCurrentDigitForm(session, digitForm) {
4485
4485
  return next;
4486
4486
  }
4487
4487
  function insertChar(session, expr) {
4488
+ const digit = formatDigits(expr, "western");
4489
+ if (/^[0-9]$/.test(digit)) return insertNumber(session, digit);
4488
4490
  const base = replaceSelectionFirst(session);
4489
4491
  if (!base.splitLeafTyping && !base.forceSplitNextLeaf) {
4490
4492
  const next = cloneEditorSession(base);
@@ -4500,17 +4502,18 @@ function insertChar(session, expr) {
4500
4502
  return inserted;
4501
4503
  }
4502
4504
  function insertNumber(session, expr) {
4505
+ const digit = formatDigits(expr, "western");
4503
4506
  const base = replaceSelectionFirst(session);
4504
4507
  if (!base.splitLeafTyping && !base.forceSplitNextLeaf) {
4505
4508
  const next = cloneEditorSession(base);
4506
- if (tryMergeLeafTyping(next, "number", expr)) {
4509
+ if (tryMergeLeafTyping(next, "number", digit)) {
4507
4510
  next.selectedStructureNodeId = null;
4508
4511
  syncSelectionToCaret(next);
4509
4512
  appendDebug(next, "mergeLeaf", `number:${expr}`);
4510
4513
  return next;
4511
4514
  }
4512
4515
  }
4513
- const inserted = insertLeaf(base, "number", expr);
4516
+ const inserted = insertLeaf(base, "number", digit);
4514
4517
  inserted.forceSplitNextLeaf = false;
4515
4518
  return inserted;
4516
4519
  }