@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.
@@ -5415,6 +5415,8 @@ function setCurrentDigitForm(session, digitForm) {
5415
5415
  return next;
5416
5416
  }
5417
5417
  function insertChar(session, expr) {
5418
+ const digit = formatDigits(expr, "western");
5419
+ if (/^[0-9]$/.test(digit)) return insertNumber(session, digit);
5418
5420
  const base = replaceSelectionFirst(session);
5419
5421
  if (!base.splitLeafTyping && !base.forceSplitNextLeaf) {
5420
5422
  const next = cloneEditorSession(base);
@@ -5430,17 +5432,18 @@ function insertChar(session, expr) {
5430
5432
  return inserted;
5431
5433
  }
5432
5434
  function insertNumber(session, expr) {
5435
+ const digit = formatDigits(expr, "western");
5433
5436
  const base = replaceSelectionFirst(session);
5434
5437
  if (!base.splitLeafTyping && !base.forceSplitNextLeaf) {
5435
5438
  const next = cloneEditorSession(base);
5436
- if (tryMergeLeafTyping(next, "number", expr)) {
5439
+ if (tryMergeLeafTyping(next, "number", digit)) {
5437
5440
  next.selectedStructureNodeId = null;
5438
5441
  syncSelectionToCaret(next);
5439
5442
  appendDebug(next, "mergeLeaf", `number:${expr}`);
5440
5443
  return next;
5441
5444
  }
5442
5445
  }
5443
- const inserted = insertLeaf(base, "number", expr);
5446
+ const inserted = insertLeaf(base, "number", digit);
5444
5447
  inserted.forceSplitNextLeaf = false;
5445
5448
  return inserted;
5446
5449
  }