@monaco-neovim-wasm/lib 0.1.9 → 0.1.10

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.
@@ -12,8 +12,8 @@ class U {
12
12
  if (t instanceof Uint8Array ? e = t : t instanceof ArrayBuffer || t instanceof SharedArrayBuffer ? e = new Uint8Array(t) : e = new Uint8Array(t), !e.byteLength) return !0;
13
13
  const i = Atomics.load(this.ctrl, 0), s = Atomics.load(this.ctrl, 1), n = s >= i ? s - i : this.capacity - (i - s), r = this.capacity - n - 1;
14
14
  if (e.byteLength > r) return !1;
15
- const a = this.capacity - s;
16
- return e.byteLength <= a ? (this.data.set(e, s), Atomics.store(this.ctrl, 1, (s + e.byteLength) % this.capacity)) : (this.data.set(e.subarray(0, a), s), this.data.set(e.subarray(a), 0), Atomics.store(this.ctrl, 1, e.byteLength - a)), Atomics.notify(this.ctrl, 1), !0;
15
+ const l = this.capacity - s;
16
+ return e.byteLength <= l ? (this.data.set(e, s), Atomics.store(this.ctrl, 1, (s + e.byteLength) % this.capacity)) : (this.data.set(e.subarray(0, l), s), this.data.set(e.subarray(l), 0), Atomics.store(this.ctrl, 1, e.byteLength - l)), Atomics.notify(this.ctrl, 1), !0;
17
17
  }
18
18
  }
19
19
  const R = 262144;
@@ -167,7 +167,7 @@ class te {
167
167
  return this.workerExitCode;
168
168
  }
169
169
  async start(t) {
170
- const { cols: e, rows: i, wasmPath: s, runtimePath: n, env: r, files: a } = t;
170
+ const { cols: e, rows: i, wasmPath: s, runtimePath: n, env: r, files: l } = t;
171
171
  if (this.inputMode = t.inputMode ?? this.init.inputMode, this.inputMode === "shared" && !X())
172
172
  throw new Error('SharedArrayBuffer is required for inputMode="shared"; serve with COOP/COEP so crossOriginIsolated is true, or use inputMode="message" with the asyncify worker.');
173
173
  const c = this.worker;
@@ -181,7 +181,7 @@ class te {
181
181
  runtimePath: String(n ?? ""),
182
182
  inputBuffer: this.sharedInput?.buffer ?? null,
183
183
  env: r ?? void 0,
184
- files: a ?? void 0
184
+ files: l ?? void 0
185
185
  };
186
186
  try {
187
187
  this.worker.postMessage(h, []);
@@ -221,8 +221,8 @@ class te {
221
221
  return;
222
222
  }
223
223
  if (this.workerExited) {
224
- const a = this.workerExitCode;
225
- s(new Error(a != null ? `nvim exited (${a})` : "nvim exited"));
224
+ const l = this.workerExitCode;
225
+ s(new Error(l != null ? `nvim exited (${l})` : "nvim exited"));
226
226
  return;
227
227
  }
228
228
  const n = this.reqId++;
@@ -308,8 +308,8 @@ class te {
308
308
  if (e === "exit") {
309
309
  const i = t, s = i.code, n = i.lastStderr;
310
310
  if (this.workerExited = !0, this.workerExitCode = s, this.pending.size) {
311
- const r = n ? `: ${n.trim()}` : "", a = new Error(`nvim exited (${s})${r}`);
312
- this.pending.forEach((c) => c.reject(a)), this.pending.clear();
311
+ const r = n ? `: ${n.trim()}` : "", l = new Error(`nvim exited (${s})${r}`);
312
+ this.pending.forEach((c) => c.reject(l)), this.pending.clear();
313
313
  }
314
314
  try {
315
315
  this.init.handlers.onExit?.(s, n);
@@ -360,18 +360,18 @@ class te {
360
360
  } else {
361
361
  let e = 0, i = 0;
362
362
  for (let r = this.inputQueueHead; r < this.inputQueue.length; r += 1) {
363
- const a = this.inputQueue[r];
364
- if (a?.byteLength) {
365
- if (i > 0 && e + a.byteLength > 262144) break;
366
- e += a.byteLength, i += 1;
363
+ const l = this.inputQueue[r];
364
+ if (l?.byteLength) {
365
+ if (i > 0 && e + l.byteLength > 262144) break;
366
+ e += l.byteLength, i += 1;
367
367
  }
368
368
  }
369
369
  if (i <= 0 || e <= 0) return;
370
370
  const s = new Uint8Array(e);
371
371
  let n = 0;
372
372
  for (let r = 0; r < i; r += 1) {
373
- const a = this.inputQueue[this.inputQueueHead + r];
374
- s.set(a, n), n += a.byteLength;
373
+ const l = this.inputQueue[this.inputQueueHead + r];
374
+ s.set(l, n), n += l.byteLength;
375
375
  }
376
376
  this.inputQueueHead += i, this.inputQueuedBytes -= e, this.postStdin(s);
377
377
  }
@@ -697,7 +697,7 @@ local function get_selections(win)
697
697
  end
698
698
 
699
699
  return get_selections(...)
700
- `, ae = `
700
+ `, le = `
701
701
  local api, fn = vim.api, vim.fn
702
702
 
703
703
  local function get_visible_range(s, e)
@@ -786,7 +786,7 @@ end
786
786
 
787
787
  return run(...)
788
788
  `;
789
- class le {
789
+ class ae {
790
790
  editor;
791
791
  opts;
792
792
  session = null;
@@ -1086,8 +1086,8 @@ class le {
1086
1086
  const r = await this.rpcCall("nvim_exec_lua", [i, s]);
1087
1087
  return this.execLuaAvailable = !0, r;
1088
1088
  } catch (r) {
1089
- const a = r?.message || String(r);
1090
- if (a.includes("Invalid method") && a.includes("nvim_exec_lua"))
1089
+ const l = r?.message || String(r);
1090
+ if (l.includes("Invalid method") && l.includes("nvim_exec_lua"))
1091
1091
  this.execLuaAvailable = !1;
1092
1092
  else
1093
1093
  throw r;
@@ -1176,8 +1176,8 @@ end)(unpack(_A))`;
1176
1176
  }
1177
1177
  computeGridSize() {
1178
1178
  try {
1179
- const t = this.editor.getLayoutInfo(), e = Math.max(0, Number(t?.contentWidth ?? t?.width ?? 0) || 0), i = Math.max(0, Number(t?.contentHeight ?? t?.height ?? 0) || 0), s = this.editor.getOption(g.editor.EditorOption.fontInfo), n = Math.max(1, Number(s?.typicalHalfwidthCharacterWidth ?? s?.maxDigitWidth ?? 0) || 0), r = Math.max(1, Number(s?.lineHeight ?? 0) || 0), a = Math.max(this.opts.minCols, Math.floor(e / n)), c = Math.max(this.opts.minRows, Math.floor(i / r));
1180
- if (Number.isFinite(a) && Number.isFinite(c) && a > 0 && c > 0) return { cols: a, rows: c };
1179
+ const t = this.editor.getLayoutInfo(), e = Math.max(0, Number(t?.contentWidth ?? t?.width ?? 0) || 0), i = Math.max(0, Number(t?.contentHeight ?? t?.height ?? 0) || 0), s = this.editor.getOption(g.editor.EditorOption.fontInfo), n = Math.max(1, Number(s?.typicalHalfwidthCharacterWidth ?? s?.maxDigitWidth ?? 0) || 0), r = Math.max(1, Number(s?.lineHeight ?? 0) || 0), l = Math.max(this.opts.minCols, Math.floor(e / n)), c = Math.max(this.opts.minRows, Math.floor(i / r));
1180
+ if (Number.isFinite(l) && Number.isFinite(c) && l > 0 && c > 0) return { cols: l, rows: c };
1181
1181
  } catch {
1182
1182
  }
1183
1183
  return { cols: this.opts.cols, rows: this.opts.rows };
@@ -1220,9 +1220,9 @@ end)(unpack(_A))`;
1220
1220
  const e = this.editor.getModel();
1221
1221
  if (!e) return;
1222
1222
  const i = this.editor.getSelection(), n = (i && !i.isEmpty() ? i.getStartPosition() : null) ?? this.editor.getPosition() ?? this.lastCursorPos ?? new g.Position(1, 1), r = String(t).split(/\r?\n/);
1223
- let a = n.lineNumber, c = n.column;
1224
- r.length <= 1 ? c += Array.from(r[0] ?? "").length : (a += r.length - 1, c = 1 + Array.from(r[r.length - 1] ?? "").length);
1225
- const h = e.validatePosition(new g.Position(a, c)), f = this.editor.getPosition() ?? this.lastCursorPos ?? n;
1223
+ let l = n.lineNumber, c = n.column;
1224
+ r.length <= 1 ? c += Array.from(r[0] ?? "").length : (l += r.length - 1, c = 1 + Array.from(r[r.length - 1] ?? "").length);
1225
+ const h = e.validatePosition(new g.Position(l, c)), f = this.editor.getPosition() ?? this.lastCursorPos ?? n;
1226
1226
  this.optimisticCursorPrevPos = f, this.optimisticCursorPos = h, this.optimisticCursorUntil = (typeof performance < "u" && performance.now ? performance.now() : Date.now()) + 120, this.lastCursorPos = h, !this.compositionActive && (this.suppressCursorSync = !0, this.editor.setPosition(h), this.suppressCursorSync = !1);
1227
1227
  }
1228
1228
  positionPreedit() {
@@ -1349,7 +1349,7 @@ end)(unpack(_A))`;
1349
1349
  await this.execLua(this.opts.startupLua, []);
1350
1350
  } catch {
1351
1351
  }
1352
- const t = await this.rpcCall("nvim_get_current_buf", []), e = S(t) ?? 1;
1352
+ const t = await this.rpcCall("nvim_get_current_buf", []), e = x(t) ?? 1;
1353
1353
  if (this.bufHandle = e, await this.rpcCall("nvim_buf_attach", [e, !0, {}]) !== !0) throw new Error("nvim_buf_attach failed");
1354
1354
  this.ensureActiveState(), this.opts.syncTabstop && this.syncTabstopFromMonaco();
1355
1355
  const s = await this.rpcCall("nvim_buf_get_lines", [e, 0, -1, !1]);
@@ -1359,8 +1359,8 @@ end)(unpack(_A))`;
1359
1359
  try {
1360
1360
  const r = this.ensureActiveState();
1361
1361
  if (r) {
1362
- const a = await this.rpcCall("nvim_buf_get_name", [e]);
1363
- r.name = typeof a == "string" ? a : "", r.name && this.buffersByName.set(r.name, e);
1362
+ const l = await this.rpcCall("nvim_buf_get_name", [e]);
1363
+ r.name = typeof l == "string" ? l : "", r.name && this.buffersByName.set(r.name, e);
1364
1364
  try {
1365
1365
  const c = await this.rpcCall("nvim_buf_get_option", [e, "filetype"]);
1366
1366
  r.filetype = typeof c == "string" ? c : "";
@@ -1435,11 +1435,11 @@ end)(unpack(_A))`;
1435
1435
  if (t === "monaco_cursor") {
1436
1436
  const [i, s] = e, n = B(this.editor, Number(i), Number(s));
1437
1437
  if (this.delegateInsertToMonaco) {
1438
- const r = this.editor.getModel(), a = r ? r.validatePosition(new g.Position(n.line, n.col)) : new g.Position(n.line, n.col);
1439
- this.lastCursorPos = a;
1438
+ const r = this.editor.getModel(), l = r ? r.validatePosition(new g.Position(n.line, n.col)) : new g.Position(n.line, n.col);
1439
+ this.lastCursorPos = l;
1440
1440
  return;
1441
1441
  }
1442
- this.updateCursor(n.line, n.col), I(this.lastMode) && this.scheduleVisualSelectionRefresh();
1442
+ this.updateCursor(n.line, n.col), v(this.lastMode) && this.scheduleVisualSelectionRefresh();
1443
1443
  return;
1444
1444
  }
1445
1445
  if (t === "monaco_mode") {
@@ -1453,7 +1453,7 @@ end)(unpack(_A))`;
1453
1453
  return;
1454
1454
  }
1455
1455
  if (t === "nvim_buf_lines_event") {
1456
- const [i, s, n, r, a] = e, c = S(i);
1456
+ const [i, s, n, r, l] = e, c = x(i);
1457
1457
  if (!c) return;
1458
1458
  const h = this.bufHandle != null && c === this.bufHandle ? this.ensureActiveState() : this.buffers.get(c) ?? null;
1459
1459
  if (!h) return;
@@ -1461,27 +1461,27 @@ end)(unpack(_A))`;
1461
1461
  this.pendingResyncAfterComposition = !0;
1462
1462
  return;
1463
1463
  }
1464
- const f = h.model, l = Number(n), u = Number(r), d = Array.isArray(a) ? a.map((p) => String(p ?? "")) : null;
1465
- if (f && Number.isInteger(l) && Number.isInteger(u) && l >= 0 && u >= l && d)
1464
+ const f = h.model, a = Number(n), u = Number(r), d = Array.isArray(l) ? l.map((p) => String(p ?? "")) : null;
1465
+ if (f && Number.isInteger(a) && Number.isInteger(u) && a >= 0 && u >= a && d)
1466
1466
  try {
1467
1467
  const p = this.bufHandle != null && c === this.bufHandle && this.editor.getModel() === f;
1468
1468
  if (p && this.delegateInsertToMonaco) {
1469
- const y = this.computeLinePatch(f, l, u, d);
1469
+ const y = this.computeLinePatch(f, a, u, d);
1470
1470
  let b = !1;
1471
1471
  try {
1472
1472
  b = f.getValueInRange(y.range) === y.text;
1473
1473
  } catch {
1474
1474
  }
1475
1475
  if (!b) {
1476
- const w = typeof performance < "u" && performance.now ? performance.now() : Date.now();
1477
- if (h.pendingFullSync || h.pendingBufEdits.length || w < this.ignoreNvimBufLinesUntil) return;
1478
- this.applyLinePatchToModel(f, l, u, d);
1476
+ const S = typeof performance < "u" && performance.now ? performance.now() : Date.now();
1477
+ if (h.pendingFullSync || h.pendingBufEdits.length || S < this.ignoreNvimBufLinesUntil) return;
1478
+ this.applyLinePatchToModel(f, a, u, d);
1479
1479
  try {
1480
1480
  h.shadowLines = f.getLinesContent();
1481
1481
  } catch {
1482
1482
  }
1483
1483
  }
1484
- } else p ? this.applyLinePatch(f, l, u, d) : this.applyLinePatchToModel(f, l, u, d);
1484
+ } else p ? this.applyLinePatch(f, a, u, d) : this.applyLinePatchToModel(f, a, u, d);
1485
1485
  } catch {
1486
1486
  }
1487
1487
  else
@@ -1490,9 +1490,9 @@ end)(unpack(_A))`;
1490
1490
  this.bufHandle != null && c === this.bufHandle && this.editor.getModel() === f ? this.applyBuffer(y) : this.setModelText(f, y);
1491
1491
  } catch {
1492
1492
  }
1493
- this.bufHandle != null && c === this.bufHandle && I(this.lastMode) && this.scheduleVisualSelectionRefresh();
1493
+ this.bufHandle != null && c === this.bufHandle && v(this.lastMode) && this.scheduleVisualSelectionRefresh();
1494
1494
  } else if (t === "nvim_buf_detach_event") {
1495
- const i = S(e?.[0]);
1495
+ const i = x(e?.[0]);
1496
1496
  if (i && this.buffers.has(i)) {
1497
1497
  const s = this.buffers.get(i);
1498
1498
  if (s.name && this.buffersByName.delete(s.name), s.createdModel)
@@ -1506,12 +1506,12 @@ end)(unpack(_A))`;
1506
1506
  } else t === "redraw" && this.handleRedraw(e);
1507
1507
  }
1508
1508
  computeLinePatch(t, e, i, s) {
1509
- const n = t.getLineCount(), r = Math.min(e, n), a = Math.min(i, n), c = new g.Position(n, t.getLineMaxColumn(n)), f = a >= n && s.length === 0 && r > 0 ? new g.Position(r, t.getLineMaxColumn(r)) : r < n ? new g.Position(r + 1, 1) : c, l = a < n ? new g.Position(a + 1, 1) : c;
1509
+ const n = t.getLineCount(), r = Math.min(e, n), l = Math.min(i, n), c = new g.Position(n, t.getLineMaxColumn(n)), f = l >= n && s.length === 0 && r > 0 ? new g.Position(r, t.getLineMaxColumn(r)) : r < n ? new g.Position(r + 1, 1) : c, a = l < n ? new g.Position(l + 1, 1) : c;
1510
1510
  let u = s.join(`
1511
1511
  `);
1512
1512
  return e >= n && i >= n && s.length > 0 && (u = `
1513
1513
  ${u}`), i < n && s.length > 0 && (u += `
1514
- `), { range: new g.Range(f.lineNumber, f.column, l.lineNumber, l.column), text: u };
1514
+ `), { range: new g.Range(f.lineNumber, f.column, a.lineNumber, a.column), text: u };
1515
1515
  }
1516
1516
  applyLinePatch(t, e, i, s) {
1517
1517
  const n = this.lastCursorPos ?? this.editor.getPosition() ?? new g.Position(1, 1), r = this.computeLinePatch(t, e, i, s);
@@ -1520,10 +1520,10 @@ ${u}`), i < n && s.length > 0 && (u += `
1520
1520
  } catch {
1521
1521
  }
1522
1522
  if (this.suppressCursorSync = !0, this.applyingFromNvim = !0, t.applyEdits([{ range: r.range, text: r.text }]), this.applyingFromNvim = !1, n && this.editor.setPosition(n), this.suppressCursorSync = !1, this.delegateInsertToMonaco) {
1523
- const a = this.getActiveState();
1524
- if (a && a.model === t)
1523
+ const l = this.getActiveState();
1524
+ if (l && l.model === t)
1525
1525
  try {
1526
- a.shadowLines = t.getLinesContent();
1526
+ l.shadowLines = t.getLinesContent();
1527
1527
  } catch {
1528
1528
  }
1529
1529
  }
@@ -1597,7 +1597,7 @@ ${u}`), i < n && s.length > 0 && (u += `
1597
1597
  this.cmdlineEl.textContent = this.cmdlineTextRaw, this.cmdlineCursorByte = null;
1598
1598
  return;
1599
1599
  }
1600
- const e = this.cmdlineTextRaw, i = Math.max(0, Math.min(Number(t) || 0, k(e))), s = Math.max(0, Math.min(e.length, v(e, i)));
1600
+ const e = this.cmdlineTextRaw, i = Math.max(0, Math.min(Number(t) || 0, k(e))), s = Math.max(0, Math.min(e.length, w(e, i)));
1601
1601
  this.cmdlineCursorByte = i, this.cmdlineEl.textContent = `${e.slice(0, s)}▏${e.slice(s)}`;
1602
1602
  }
1603
1603
  setMessage(t) {
@@ -1633,8 +1633,8 @@ ${u}`), i < n && s.length > 0 && (u += `
1633
1633
  n.style.padding = "2px 10px", n.style.display = "flex", n.style.gap = "10px", n.style.justifyContent = "space-between", n.style.background = i === e ? "rgba(255,255,255,0.12)" : "transparent";
1634
1634
  const r = document.createElement("span");
1635
1635
  r.textContent = s.word ?? "";
1636
- const a = document.createElement("span");
1637
- a.style.opacity = "0.7", a.textContent = s.menu ?? s.kind ?? "", n.appendChild(r), n.appendChild(a), this.popupEl.appendChild(n);
1636
+ const l = document.createElement("span");
1637
+ l.style.opacity = "0.7", l.textContent = s.menu ?? s.kind ?? "", n.appendChild(r), n.appendChild(l), this.popupEl.appendChild(n);
1638
1638
  }
1639
1639
  this.popupEl.style.display = "block";
1640
1640
  }
@@ -1662,10 +1662,10 @@ ${u}`), i < n && s.length > 0 && (u += `
1662
1662
  } catch {
1663
1663
  }
1664
1664
  if (i === "wrappedLine" && (e === "down" || e === "up")) {
1665
- const a = e === "down" ? "cursorDown" : "cursorUp";
1665
+ const l = e === "down" ? "cursorDown" : "cursorUp";
1666
1666
  for (let c = 0; c < s; c += 1)
1667
1667
  try {
1668
- this.editor.trigger("monaco-neovim-wasm", a, null);
1668
+ this.editor.trigger("monaco-neovim-wasm", l, null);
1669
1669
  } catch {
1670
1670
  }
1671
1671
  return !0;
@@ -1694,7 +1694,7 @@ ${u}`), i < n && s.length > 0 && (u += `
1694
1694
  } catch {
1695
1695
  }
1696
1696
  if (r <= 0) return !1;
1697
- const a = () => {
1697
+ const l = () => {
1698
1698
  try {
1699
1699
  this.editor.revealPositionInCenterIfOutsideViewport(i);
1700
1700
  } catch {
@@ -1706,16 +1706,16 @@ ${u}`), i < n && s.length > 0 && (u += `
1706
1706
  } catch {
1707
1707
  }
1708
1708
  if (!c) {
1709
- a();
1709
+ l();
1710
1710
  try {
1711
1711
  c = this.editor.getScrolledVisiblePosition(i);
1712
1712
  } catch {
1713
1713
  }
1714
1714
  }
1715
1715
  if (!c || !Number.isFinite(c.top) || !Number.isFinite(c.height)) return !1;
1716
- const h = this.editor.getScrollTop(), f = c.top, l = c.top + c.height, u = Math.max(0, r - n);
1716
+ const h = this.editor.getScrollTop(), f = c.top, a = c.top + c.height, u = Math.max(0, r - n);
1717
1717
  let d = 0;
1718
- if (f < n ? d = f - n : l > u && (d = l - u), !d) return !1;
1718
+ if (f < n ? d = f - n : a > u && (d = a - u), !d) return !1;
1719
1719
  try {
1720
1720
  this.editor.setScrollTop(Math.max(0, h + d));
1721
1721
  } catch {
@@ -1723,10 +1723,10 @@ ${u}`), i < n && s.length > 0 && (u += `
1723
1723
  return !0;
1724
1724
  }
1725
1725
  applyMonacoScroll(t) {
1726
- const e = typeof t.by == "string" ? t.by : "", i = typeof t.direction == "string" ? t.direction : "", s = Math.max(1, Number(t.value ?? 1) || 1), n = !!t.moveCursor, r = typeof t.cursorBy == "string" ? t.cursorBy : "wrappedLine", a = Math.max(3, this.uiRows || this.opts.rows), c = this.editor.getOption(g.editor.EditorOption.fontInfo), h = Math.max(1, Number(c?.lineHeight ?? 0) || 0), f = Math.max(1, a - 2), l = Math.max(1, Math.floor(f / 2));
1726
+ const e = typeof t.by == "string" ? t.by : "", i = typeof t.direction == "string" ? t.direction : "", s = Math.max(1, Number(t.value ?? 1) || 1), n = !!t.moveCursor, r = typeof t.cursorBy == "string" ? t.cursorBy : "wrappedLine", l = Math.max(3, this.uiRows || this.opts.rows), c = this.editor.getOption(g.editor.EditorOption.fontInfo), h = Math.max(1, Number(c?.lineHeight ?? 0) || 0), f = Math.max(1, l - 2), a = Math.max(1, Math.floor(f / 2));
1727
1727
  let u = s;
1728
1728
  if (e === "page") u = f * s;
1729
- else if (e === "halfPage") u = l * s;
1729
+ else if (e === "halfPage") u = a * s;
1730
1730
  else if (e === "line") u = s;
1731
1731
  else return !1;
1732
1732
  const d = i === "up" ? -1 : i === "down" ? 1 : 0;
@@ -1752,7 +1752,7 @@ ${u}`), i < n && s.length > 0 && (u += `
1752
1752
  applyMonacoReveal(t) {
1753
1753
  const e = typeof t.direction == "string" ? t.direction : "", i = !!t.resetCursor, s = this.editor.getPosition();
1754
1754
  if (!s) return !1;
1755
- const n = s.lineNumber, r = Math.max(1, this.uiRows || this.opts.rows), a = this.editor.getOption(g.editor.EditorOption.fontInfo), c = Math.max(1, Number(a?.lineHeight ?? 0) || 0);
1755
+ const n = s.lineNumber, r = Math.max(1, this.uiRows || this.opts.rows), l = this.editor.getOption(g.editor.EditorOption.fontInfo), c = Math.max(1, Number(l?.lineHeight ?? 0) || 0);
1756
1756
  this.suppressCursorSync = !0;
1757
1757
  try {
1758
1758
  if (e === "top") {
@@ -1767,7 +1767,7 @@ ${u}`), i < n && s.length > 0 && (u += `
1767
1767
  if (i) {
1768
1768
  const h = this.editor.getModel();
1769
1769
  if (h) {
1770
- const f = h.getLineContent(n) ?? "", l = /\S/.exec(f), u = l ? l.index + 1 : 1, d = h.validatePosition(new g.Position(n, u));
1770
+ const f = h.getLineContent(n) ?? "", a = /\S/.exec(f), u = a ? a.index + 1 : 1, d = h.validatePosition(new g.Position(n, u));
1771
1771
  this.editor.setPosition(d), this.lastCursorPos = d;
1772
1772
  }
1773
1773
  }
@@ -1788,23 +1788,23 @@ ${u}`), i < n && s.length > 0 && (u += `
1788
1788
  } catch {
1789
1789
  }
1790
1790
  n = Math.max(1, Math.min(n, i.getLineCount())), r = Math.max(1, Math.min(r, i.getLineCount())), r < n && (r = n);
1791
- let a = n;
1791
+ let l = n;
1792
1792
  if (e === "top")
1793
- a = n + (s - 1);
1793
+ l = n + (s - 1);
1794
1794
  else if (e === "middle")
1795
- a = Math.floor((n + r) / 2);
1795
+ l = Math.floor((n + r) / 2);
1796
1796
  else if (e === "bottom")
1797
- a = r - (s - 1);
1797
+ l = r - (s - 1);
1798
1798
  else
1799
1799
  return;
1800
- a = Math.max(n, Math.min(r, a));
1801
- const c = i.getLineContent(a) ?? "", h = /\S/.exec(c), f = h ? h.index + 1 : 1, l = i.validatePosition(new g.Position(a, f));
1800
+ l = Math.max(n, Math.min(r, l));
1801
+ const c = i.getLineContent(l) ?? "", h = /\S/.exec(c), f = h ? h.index + 1 : 1, a = i.validatePosition(new g.Position(l, f));
1802
1802
  this.suppressCursorSync = !0;
1803
1803
  try {
1804
- this.editor.setPosition(l);
1804
+ this.editor.setPosition(a);
1805
1805
  } catch {
1806
1806
  }
1807
- this.lastCursorPos = l, this.suppressCursorSync = !1;
1807
+ this.lastCursorPos = a, this.suppressCursorSync = !1;
1808
1808
  }
1809
1809
  syncTabstopFromMonaco() {
1810
1810
  const t = this.editor.getModel();
@@ -1838,17 +1838,17 @@ ${u}`), i < n && s.length > 0 && (u += `
1838
1838
  continue;
1839
1839
  }
1840
1840
  if (i === "cmdline_show") {
1841
- const r = n[0], a = Math.max(0, Number(n[1] ?? 0) || 0), c = typeof n[2] == "string" ? n[2] : "", h = typeof n[3] == "string" ? n[3] : "", f = Math.max(0, Number(n[4] ?? 0) || 0), l = h || c || "", u = " ".repeat(f), d = N(r), m = `${u}${l}${d}`;
1841
+ const r = n[0], l = Math.max(0, Number(n[1] ?? 0) || 0), c = typeof n[2] == "string" ? n[2] : "", h = typeof n[3] == "string" ? n[3] : "", f = Math.max(0, Number(n[4] ?? 0) || 0), a = h || c || "", u = " ".repeat(f), d = N(r), m = `${u}${a}${d}`;
1842
1842
  this.setCmdline(m);
1843
- const p = k(`${u}${l}`), y = k(d);
1843
+ const p = k(`${u}${a}`), y = k(d);
1844
1844
  this.cmdlineCursorOffsetBytes = p, this.cmdlineCursorContentBytes = y;
1845
- const b = a <= y ? this.cmdlineCursorOffsetBytes + a : a;
1845
+ const b = l <= y ? this.cmdlineCursorOffsetBytes + l : l;
1846
1846
  this.setCmdlineCursor(b), this.scheduleSearchHighlightRefresh();
1847
1847
  continue;
1848
1848
  }
1849
1849
  if (i === "cmdline_pos") {
1850
- const r = Math.max(0, Number(n[0] ?? 0) || 0), a = this.cmdlineCursorOffsetBytes > 0 && r <= this.cmdlineCursorContentBytes ? this.cmdlineCursorOffsetBytes + r : r;
1851
- this.setCmdlineCursor(a), this.scheduleSearchHighlightRefresh();
1850
+ const r = Math.max(0, Number(n[0] ?? 0) || 0), l = this.cmdlineCursorOffsetBytes > 0 && r <= this.cmdlineCursorContentBytes ? this.cmdlineCursorOffsetBytes + r : r;
1851
+ this.setCmdlineCursor(l), this.scheduleSearchHighlightRefresh();
1852
1852
  continue;
1853
1853
  }
1854
1854
  if (i === "msg_clear") {
@@ -1856,7 +1856,7 @@ ${u}`), i < n && s.length > 0 && (u += `
1856
1856
  continue;
1857
1857
  }
1858
1858
  if (i === "msg_show") {
1859
- const r = typeof n[0] == "string" ? n[0] : "", a = n[1], c = !!n[2], h = !!n[4], f = N(a);
1859
+ const r = typeof n[0] == "string" ? n[0] : "", l = n[1], c = !!n[2], h = !!n[4], f = N(l);
1860
1860
  if (r === "empty" && !f) {
1861
1861
  this.setMessage(null);
1862
1862
  continue;
@@ -1874,8 +1874,8 @@ ${u}`), i < n && s.length > 0 && (u += `
1874
1874
  continue;
1875
1875
  }
1876
1876
  if (i === "msg_showmode" || i === "msg_showcmd" || i === "msg_ruler") {
1877
- const r = n[0], a = N(r);
1878
- this.setMessage(a || null);
1877
+ const r = n[0], l = N(r);
1878
+ this.setMessage(l || null);
1879
1879
  continue;
1880
1880
  }
1881
1881
  if (i === "popupmenu_hide") {
@@ -1883,8 +1883,8 @@ ${u}`), i < n && s.length > 0 && (u += `
1883
1883
  continue;
1884
1884
  }
1885
1885
  if (i === "popupmenu_show") {
1886
- const r = n[0], a = Number(n[1] ?? -1), c = be(r);
1887
- this.setPopupmenu(c, Number.isFinite(a) ? a : -1);
1886
+ const r = n[0], l = Number(n[1] ?? -1), c = be(r);
1887
+ this.setPopupmenu(c, Number.isFinite(l) ? l : -1);
1888
1888
  continue;
1889
1889
  }
1890
1890
  if (i === "popupmenu_select") {
@@ -1902,47 +1902,59 @@ ${u}`), i < n && s.length > 0 && (u += `
1902
1902
  initTextInputListeners() {
1903
1903
  const t = this.editor.getDomNode();
1904
1904
  if (!t) return;
1905
- const e = (l) => {
1905
+ const e = (a) => {
1906
1906
  try {
1907
- l.stopImmediatePropagation?.();
1907
+ a.stopImmediatePropagation?.();
1908
1908
  } catch {
1909
1909
  }
1910
1910
  try {
1911
- l.stopPropagation();
1911
+ a.stopPropagation();
1912
1912
  } catch {
1913
1913
  }
1914
- }, i = (l) => {
1914
+ }, i = (a) => {
1915
1915
  try {
1916
- const u = l;
1916
+ const u = a;
1917
1917
  return !u || typeof u.tagName != "string" || u.tagName !== "TEXTAREA" || !u.classList?.contains?.("inputarea") ? null : u;
1918
1918
  } catch {
1919
1919
  return null;
1920
1920
  }
1921
- }, s = (l) => {
1922
- if (this.compositionActive || l.isComposing || l.getModifierState?.("AltGraph")) return;
1923
- if (x(this.lastMode) && !this.delegateInsertToMonaco && !this.exitingInsertMode && !l.ctrlKey && !l.metaKey && typeof l.key == "string" && l.key.length === 1) {
1924
- const p = /^[\x20-\x7E]$/.test(l.key);
1925
- if (!!!(l.altKey && p)) {
1926
- if (!this.opts.shouldHandleKey(l)) return;
1927
- e(l);
1921
+ }, s = (a) => {
1922
+ if (this.compositionActive || a.isComposing || a.getModifierState?.("AltGraph")) return;
1923
+ const u = this.delegateInsertToMonaco && !this.exitingInsertMode;
1924
+ if (!u && (a.key === "Backspace" || a.key === "Delete" || a.key === "Escape")) {
1925
+ if (!this.opts.shouldHandleKey(a)) return;
1926
+ const p = this.opts.translateKey(a);
1927
+ if (!p) return;
1928
+ e(a);
1929
+ try {
1930
+ a.preventDefault();
1931
+ } catch {
1932
+ }
1933
+ this.exitingInsertMode ? this.pendingKeysAfterExit += p : this.sendInput(p);
1934
+ return;
1935
+ }
1936
+ if (M(this.lastMode) && !this.delegateInsertToMonaco && !this.exitingInsertMode && !a.ctrlKey && !a.metaKey && typeof a.key == "string" && a.key.length === 1) {
1937
+ const p = /^[\x20-\x7E]$/.test(a.key);
1938
+ if (!!!(a.altKey && p)) {
1939
+ if (!this.opts.shouldHandleKey(a)) return;
1940
+ e(a);
1928
1941
  return;
1929
1942
  }
1930
1943
  }
1931
- if (!l.ctrlKey && !l.altKey && !l.metaKey) return;
1932
- const u = this.modifiedKeyName(l);
1933
- if (!u || !this.opts.shouldHandleKey(l)) return;
1934
- const d = this.delegateInsertToMonaco && !this.exitingInsertMode;
1935
- if (this.hasExplicitModAllowlist(d)) {
1936
- if (!this.shouldForwardModifiedKeys(l, d)) return;
1937
- } else if (d || !l.ctrlKey || l.altKey || l.metaKey || u !== "f" && u !== "b" && u !== "d" && u !== "u" && u !== "e" && u !== "y" && u !== "v") return;
1938
- const m = this.opts.translateKey(l);
1944
+ if (!a.ctrlKey && !a.altKey && !a.metaKey) return;
1945
+ const d = this.modifiedKeyName(a);
1946
+ if (!d || !this.opts.shouldHandleKey(a)) return;
1947
+ if (this.hasExplicitModAllowlist(u)) {
1948
+ if (!this.shouldForwardModifiedKeys(a, u)) return;
1949
+ } else if (u || !a.ctrlKey || a.altKey || a.metaKey || d !== "f" && d !== "b" && d !== "d" && d !== "u" && d !== "e" && d !== "y" && d !== "v") return;
1950
+ const m = this.opts.translateKey(a);
1939
1951
  if (m) {
1940
- e(l);
1952
+ e(a);
1941
1953
  try {
1942
- l.preventDefault();
1954
+ a.preventDefault();
1943
1955
  } catch {
1944
1956
  }
1945
- this.exitingInsertMode ? (this.debugLog(`keydown(capture) buffer: key=${JSON.stringify(l.key)} code=${JSON.stringify(l.code)} mods=${l.ctrlKey ? "C" : ""}${l.altKey ? "A" : ""}${l.metaKey ? "D" : ""}${l.shiftKey ? "S" : ""} -> ${m}`), this.pendingKeysAfterExit += m) : (d && this.flushPendingMonacoSync(), this.debugLog(`keydown(capture) send: key=${JSON.stringify(l.key)} code=${JSON.stringify(l.code)} mods=${l.ctrlKey ? "C" : ""}${l.altKey ? "A" : ""}${l.metaKey ? "D" : ""}${l.shiftKey ? "S" : ""} -> ${m}`), this.sendInput(m));
1957
+ this.exitingInsertMode ? (this.debugLog(`keydown(capture) buffer: key=${JSON.stringify(a.key)} code=${JSON.stringify(a.code)} mods=${a.ctrlKey ? "C" : ""}${a.altKey ? "A" : ""}${a.metaKey ? "D" : ""}${a.shiftKey ? "S" : ""} -> ${m}`), this.pendingKeysAfterExit += m) : (u && this.flushPendingMonacoSync(), this.debugLog(`keydown(capture) send: key=${JSON.stringify(a.key)} code=${JSON.stringify(a.code)} mods=${a.ctrlKey ? "C" : ""}${a.altKey ? "A" : ""}${a.metaKey ? "D" : ""}${a.shiftKey ? "S" : ""} -> ${m}`), this.sendInput(m));
1946
1958
  }
1947
1959
  }, n = () => {
1948
1960
  if (this.compositionActive = !0, this.debugLog(`compositionstart delegateInsert=${this.delegateInsertToMonaco} mode=${JSON.stringify(this.lastMode)}`), this.delegateInsertToMonaco) {
@@ -1950,14 +1962,14 @@ ${u}`), i < n && s.length > 0 && (u += `
1950
1962
  return;
1951
1963
  }
1952
1964
  this.setPreedit("");
1953
- }, r = (l) => {
1954
- if (this.compositionActive = !1, this.setPreedit(null), this.debugLog(`compositionend delegateInsert=${this.delegateInsertToMonaco} mode=${JSON.stringify(this.lastMode)} data=${JSON.stringify(l.data ?? "")}`), this.delegateInsertToMonaco) {
1965
+ }, r = (a) => {
1966
+ if (this.compositionActive = !1, this.setPreedit(null), this.debugLog(`compositionend delegateInsert=${this.delegateInsertToMonaco} mode=${JSON.stringify(this.lastMode)} data=${JSON.stringify(a.data ?? "")}`), this.delegateInsertToMonaco) {
1955
1967
  this.scheduleCursorSyncToNvim();
1956
1968
  return;
1957
1969
  }
1958
- const u = l.target;
1959
- if (x(this.lastMode)) {
1960
- const d = typeof l.data == "string" ? l.data : "", m = !d && u?.value ? String(u.value) : "", p = d || m;
1970
+ const u = a.target;
1971
+ if (M(this.lastMode)) {
1972
+ const d = typeof a.data == "string" ? a.data : "", m = !d && u?.value ? String(u.value) : "", p = d || m;
1961
1973
  p && this.sendCmdlineImeText(p);
1962
1974
  }
1963
1975
  try {
@@ -1966,17 +1978,17 @@ ${u}`), i < n && s.length > 0 && (u += `
1966
1978
  } catch {
1967
1979
  }
1968
1980
  this.pendingResyncAfterComposition && (this.pendingResyncAfterComposition = !1, this.scheduleResync());
1969
- }, a = (l) => {
1981
+ }, l = (a) => {
1970
1982
  if (this.compositionActive || (this.compositionActive = !0), this.delegateInsertToMonaco) return;
1971
- const u = i(l.target), d = typeof l.data == "string" ? l.data : u?.value ? String(u.value) : "";
1983
+ const u = i(a.target), d = typeof a.data == "string" ? a.data : u?.value ? String(u.value) : "";
1972
1984
  this.setPreedit(d || "");
1973
- }, c = (l) => {
1974
- i(l.target) && (this.delegateInsertToMonaco && !this.exitingInsertMode || e(l));
1975
- }, h = (l) => {
1976
- const u = i(l.target);
1985
+ }, c = (a) => {
1986
+ i(a.target) && (this.delegateInsertToMonaco && !this.exitingInsertMode || e(a));
1987
+ }, h = (a) => {
1988
+ const u = i(a.target);
1977
1989
  if (!u || this.delegateInsertToMonaco && !this.exitingInsertMode) return;
1978
- e(l);
1979
- const d = l;
1990
+ e(a);
1991
+ const d = a;
1980
1992
  if (this.ignoreNextInputEvent) {
1981
1993
  this.ignoreNextInputEvent = !1;
1982
1994
  try {
@@ -1986,7 +1998,7 @@ ${u}`), i < n && s.length > 0 && (u += `
1986
1998
  return;
1987
1999
  }
1988
2000
  if (!this.compositionActive) {
1989
- if (x(this.lastMode)) {
2001
+ if (M(this.lastMode)) {
1990
2002
  const m = typeof d.data == "string" ? d.data : "", p = !m && u?.value ? String(u.value) : "", y = m || p;
1991
2003
  y && this.sendCmdlineImeText(y);
1992
2004
  }
@@ -1995,13 +2007,13 @@ ${u}`), i < n && s.length > 0 && (u += `
1995
2007
  } catch {
1996
2008
  }
1997
2009
  }
1998
- }, f = (l) => {
1999
- if (!i(l.target) || this.delegateInsertToMonaco && !this.exitingInsertMode) return;
2000
- e(l);
2001
- const u = l.clipboardData?.getData("text/plain") ?? "";
2002
- u && (l.preventDefault(), this.ignoreNextInputEvent = !0, this.pasteText(u));
2010
+ }, f = (a) => {
2011
+ if (!i(a.target) || this.delegateInsertToMonaco && !this.exitingInsertMode) return;
2012
+ e(a);
2013
+ const u = a.clipboardData?.getData("text/plain") ?? "";
2014
+ u && (a.preventDefault(), this.ignoreNextInputEvent = !0, this.pasteText(u));
2003
2015
  try {
2004
- l.target?.value && (l.target.value = "");
2016
+ a.target?.value && (a.target.value = "");
2005
2017
  } catch {
2006
2018
  }
2007
2019
  };
@@ -2012,7 +2024,7 @@ ${u}`), i < n && s.length > 0 && (u += `
2012
2024
  _(t, "input", h, !0),
2013
2025
  _(t, "paste", f, !0),
2014
2026
  _(t, "compositionstart", n, !0),
2015
- _(t, "compositionupdate", a, !0),
2027
+ _(t, "compositionupdate", l, !0),
2016
2028
  _(t, "compositionend", r, !0)
2017
2029
  );
2018
2030
  }
@@ -2120,7 +2132,7 @@ ${u}`), i < n && s.length > 0 && (u += `
2120
2132
  } catch {
2121
2133
  }
2122
2134
  e = Math.max(1, Math.min(e, t.getLineCount())), i = Math.max(1, Math.min(i, t.getLineCount()));
2123
- const s = await this.execLua(ae, [e, i]);
2135
+ const s = await this.execLua(le, [e, i]);
2124
2136
  this.applySearchHighlights(s, t);
2125
2137
  } catch {
2126
2138
  }
@@ -2137,7 +2149,7 @@ ${u}`), i < n && s.length > 0 && (u += `
2137
2149
  this.clearSearchHighlights();
2138
2150
  return;
2139
2151
  }
2140
- const n = Array.isArray(i.matches) ? i.matches : [], r = i.current && typeof i.current == "object" ? i.current : null, a = r && Number.isFinite(Number(r.l)) ? `${Number(r.l)}:${Number(r.s)}:${Number(r.e)}` : null, c = [], h = 2e3, f = /* @__PURE__ */ new Map(), l = (u) => {
2152
+ const n = Array.isArray(i.matches) ? i.matches : [], r = i.current && typeof i.current == "object" ? i.current : null, l = r && Number.isFinite(Number(r.l)) ? `${Number(r.l)}:${Number(r.s)}:${Number(r.e)}` : null, c = [], h = 2e3, f = /* @__PURE__ */ new Map(), a = (u) => {
2141
2153
  if (f.has(u)) return f.get(u);
2142
2154
  const d = e.getLineContent(u) ?? "";
2143
2155
  return f.set(u, d), d;
@@ -2147,9 +2159,9 @@ ${u}`), i < n && s.length > 0 && (u += `
2147
2159
  if (!Number.isFinite(m) || !Number.isFinite(p) || !Number.isFinite(y)) continue;
2148
2160
  const b = m + 1;
2149
2161
  if (b < 1 || b > e.getLineCount()) continue;
2150
- const w = l(b), E = v(w, Math.max(0, p)) + 1, D = v(w, Math.max(0, y)) + 1;
2162
+ const S = a(b), E = w(S, Math.max(0, p)) + 1, D = w(S, Math.max(0, y)) + 1;
2151
2163
  if (D <= E) continue;
2152
- const W = `${m}:${p}:${y}`, z = a && W === a ? "monaco-neovim-search-current" : "monaco-neovim-search-match";
2164
+ const W = `${m}:${p}:${y}`, z = l && W === l ? "monaco-neovim-search-current" : "monaco-neovim-search-match";
2153
2165
  c.push({
2154
2166
  range: new g.Range(b, E, b, D),
2155
2167
  options: { inlineClassName: z }
@@ -2166,20 +2178,20 @@ ${u}`), i < n && s.length > 0 && (u += `
2166
2178
  this.ensureVisualStyle();
2167
2179
  const s = ge(e) === "V", n = [];
2168
2180
  if (s) {
2169
- let r = 1 / 0, a = -1 / 0;
2181
+ let r = 1 / 0, l = -1 / 0;
2170
2182
  for (const c of t) {
2171
2183
  const h = c.getStartPosition(), f = c.getEndPosition();
2172
- r = Math.min(r, h.lineNumber, f.lineNumber), a = Math.max(a, h.lineNumber, f.lineNumber);
2184
+ r = Math.min(r, h.lineNumber, f.lineNumber), l = Math.max(l, h.lineNumber, f.lineNumber);
2173
2185
  }
2174
- Number.isFinite(r) && Number.isFinite(a) && a >= r && n.push({
2175
- range: new g.Range(r, 1, a, 1),
2186
+ Number.isFinite(r) && Number.isFinite(l) && l >= r && n.push({
2187
+ range: new g.Range(r, 1, l, 1),
2176
2188
  options: { isWholeLine: !0, className: "monaco-neovim-visual-line" }
2177
2189
  });
2178
2190
  } else
2179
2191
  for (const r of t) {
2180
- const a = r.getStartPosition(), c = r.getEndPosition();
2192
+ const l = r.getStartPosition(), c = r.getEndPosition();
2181
2193
  n.push({
2182
- range: g.Range.fromPositions(a, c),
2194
+ range: g.Range.fromPositions(l, c),
2183
2195
  options: { inlineClassName: "monaco-neovim-visual-inline" }
2184
2196
  });
2185
2197
  }
@@ -2192,19 +2204,27 @@ ${u}`), i < n && s.length > 0 && (u += `
2192
2204
  applyNvimMode(t) {
2193
2205
  const e = typeof t == "string" ? t : "";
2194
2206
  if (!e || e === this.lastMode) return;
2195
- this.lastMode = e, x(e) && (this.ignoreNextInputEvent = !1);
2196
- const i = $(e) && !this.recordingRegister;
2197
- if (i !== this.delegateInsertToMonaco) {
2198
- this.delegateInsertToMonaco = i;
2199
- const s = this.ensureActiveState();
2200
- i ? (this.setPreedit(null), this.dotRepeatKeys = "", this.dotRepeatBackspaces = 0, s && (s.shadowLines = this.editor.getModel()?.getLinesContent() ?? null, s.pendingBufEdits = [], s.pendingFullSync = !1, s.pendingCursorSync = !1)) : (s && ((s.pendingBufEdits.length || s.pendingCursorSync || s.pendingFullSync) && this.flushPendingMonacoSync(), s.shadowLines = null, s.pendingBufEdits = [], s.pendingFullSync = !1, s.pendingCursorSync = !1), this.dotRepeatKeys = "", this.dotRepeatBackspaces = 0);
2207
+ const i = this.lastMode;
2208
+ this.lastMode = e, M(e) && (this.ignoreNextInputEvent = !1);
2209
+ const s = $(e) && !this.recordingRegister;
2210
+ if (s !== this.delegateInsertToMonaco) {
2211
+ this.delegateInsertToMonaco = s;
2212
+ const n = this.ensureActiveState();
2213
+ s ? (this.setPreedit(null), this.dotRepeatKeys = "", this.dotRepeatBackspaces = 0, n && (n.shadowLines = this.editor.getModel()?.getLinesContent() ?? null, n.pendingBufEdits = [], n.pendingFullSync = !1, n.pendingCursorSync = !1)) : (n && ((n.pendingBufEdits.length || n.pendingCursorSync || n.pendingFullSync) && this.flushPendingMonacoSync(), n.shadowLines = null, n.pendingBufEdits = [], n.pendingFullSync = !1, n.pendingCursorSync = !1), this.dotRepeatKeys = "", this.dotRepeatBackspaces = 0);
2201
2214
  }
2202
2215
  if (this.exitingInsertMode && !$(e)) {
2203
2216
  this.exitInsertTimer && (clearTimeout(this.exitInsertTimer), this.exitInsertTimer = null), this.exitingInsertMode = !1;
2204
- const s = this.pendingKeysAfterExit;
2205
- this.pendingKeysAfterExit = "", s && this.sendInput(s);
2217
+ const n = this.pendingKeysAfterExit;
2218
+ this.pendingKeysAfterExit = "", n && this.sendInput(n);
2206
2219
  }
2207
- this.applyCursorStyle(e), this.opts.onModeChange && this.opts.onModeChange(e), this.updateVisualSelection(e), this.scheduleSearchHighlightRefresh();
2220
+ if (this.applyCursorStyle(e), this.opts.onModeChange && this.opts.onModeChange(e), this.updateVisualSelection(e), v(i) && !v(e))
2221
+ try {
2222
+ const n = this.editor.getPosition() ?? this.lastCursorPos;
2223
+ n && !this.compositionActive && (this.suppressCursorSync = !0, this.editor.setSelection(new g.Selection(n.lineNumber, n.column, n.lineNumber, n.column)), this.suppressCursorSync = !1);
2224
+ } catch {
2225
+ this.suppressCursorSync = !1;
2226
+ }
2227
+ this.scheduleSearchHighlightRefresh();
2208
2228
  }
2209
2229
  armInsertExit() {
2210
2230
  this.exitingInsertMode = !0, this.pendingKeysAfterExit = "", this.exitInsertTimer && (clearTimeout(this.exitInsertTimer), this.exitInsertTimer = null), this.exitInsertTimer = window.setTimeout(() => {
@@ -2282,7 +2302,7 @@ vim.opt.ei = ei
2282
2302
  }
2283
2303
  return;
2284
2304
  }
2285
- if (x(this.lastMode) && !this.compositionActive && !e.isComposing && !e.getModifierState?.("AltGraph") && !e.ctrlKey && !e.metaKey && typeof e.key == "string" && e.key.length === 1) {
2305
+ if (M(this.lastMode) && !this.compositionActive && !e.isComposing && !e.getModifierState?.("AltGraph") && !e.ctrlKey && !e.metaKey && typeof e.key == "string" && e.key.length === 1) {
2286
2306
  const s = /^[\x20-\x7E]$/.test(e.key);
2287
2307
  if (!!!(e.altKey && s))
2288
2308
  return this.opts.shouldHandleKey(e), void 0;
@@ -2300,15 +2320,15 @@ vim.opt.ei = ei
2300
2320
  }
2301
2321
  handleMouse(t) {
2302
2322
  if (this.delegateInsertToMonaco || !this.bufHandle || !t.target?.position) return;
2303
- const { lineNumber: e, column: i } = t.target.position, s = this.editor.getModel(), n = Math.max(0, i - 1), r = s ? s.getLineContent(e) ?? "" : "", a = s ? C(r, n) : n;
2304
- this.sendNotify("nvim_win_set_cursor", [0, [e, a]]);
2323
+ const { lineNumber: e, column: i } = t.target.position, s = this.editor.getModel(), n = Math.max(0, i - 1), r = s ? s.getLineContent(e) ?? "" : "", l = s ? C(r, n) : n;
2324
+ this.sendNotify("nvim_win_set_cursor", [0, [e, l]]);
2305
2325
  }
2306
2326
  handleSelection(t) {
2307
2327
  if (this.delegateInsertToMonaco || !this.session || !this.session.isRunning() || !this.bufHandle || this.suppressCursorSync || this.compositionActive || t?.isComposing) return;
2308
2328
  const e = t.selection;
2309
2329
  if (e && t.source === "mouse") {
2310
2330
  if (e.isEmpty()) {
2311
- I(this.lastMode) && this.sendInput("<Esc>");
2331
+ v(this.lastMode) && this.sendInput("<Esc>");
2312
2332
  return;
2313
2333
  }
2314
2334
  this.pendingSelection = new g.Selection(
@@ -2328,7 +2348,7 @@ vim.opt.ei = ei
2328
2348
  if (this.delegateInsertToMonaco || !this.session || !this.session.isRunning() || !this.bufHandle) return;
2329
2349
  const e = this.editor.getModel();
2330
2350
  if (!e) return;
2331
- const i = t.selectionStartLineNumber, s = Math.max(0, t.selectionStartColumn - 1), n = t.positionLineNumber, r = Math.max(0, t.positionColumn - 1), a = e.getLineContent(i) ?? "", c = e.getLineContent(n) ?? "", h = C(a, s), f = C(c, r);
2351
+ const i = t.selectionStartLineNumber, s = Math.max(0, t.selectionStartColumn - 1), n = t.positionLineNumber, r = Math.max(0, t.positionColumn - 1), l = e.getLineContent(i) ?? "", c = e.getLineContent(n) ?? "", h = C(l, s), f = C(c, r);
2332
2352
  await this.execLua(`
2333
2353
  local api = vim.api
2334
2354
  local fn = vim.fn
@@ -2396,7 +2416,12 @@ api.nvim_win_set_cursor(0, { b_line, b_col0 })
2396
2416
  this.sendNotify("nvim_paste", [e, i, -1]);
2397
2417
  }
2398
2418
  handleMonacoModelChange(t) {
2399
- if (!this.delegateInsertToMonaco || this.applyingFromNvim || !this.session || !this.session.isRunning() || !this.bufHandle) return;
2419
+ if (!this.delegateInsertToMonaco) {
2420
+ if (this.applyingFromNvim || !this.session || !this.session.isRunning() || !this.bufHandle || this.compositionActive || t?.isComposing) return;
2421
+ t?.changes?.length && this.scheduleResync();
2422
+ return;
2423
+ }
2424
+ if (this.applyingFromNvim || !this.session || !this.session.isRunning() || !this.bufHandle) return;
2400
2425
  const e = this.editor.getModel();
2401
2426
  if (!e) return;
2402
2427
  const i = this.ensureActiveState();
@@ -2409,20 +2434,20 @@ api.nvim_win_set_cursor(0, { b_line, b_col0 })
2409
2434
  i.pendingFullSync = !0, i.pendingCursorSync = !0, i.shadowLines = e.getLinesContent(), this.scheduleFlushPendingMonacoSync();
2410
2435
  return;
2411
2436
  }
2412
- const s = t.changes[0], n = s.range, r = n.startLineNumber - 1, a = n.endLineNumber - 1;
2413
- if (r < 0 || a < 0) return;
2414
- if (i.shadowLines[r] == null || i.shadowLines[a] == null) {
2437
+ const s = t.changes[0], n = s.range, r = n.startLineNumber - 1, l = n.endLineNumber - 1;
2438
+ if (r < 0 || l < 0) return;
2439
+ if (i.shadowLines[r] == null || i.shadowLines[l] == null) {
2415
2440
  i.pendingFullSync = !0, i.pendingCursorSync = !0, i.shadowLines = e.getLinesContent(), this.scheduleFlushPendingMonacoSync();
2416
2441
  return;
2417
2442
  }
2418
- const c = i.shadowLines[r] ?? "", h = i.shadowLines[a] ?? "", f = Math.max(0, n.startColumn - 1), l = Math.max(0, n.endColumn - 1), u = C(c, f), d = C(h, l), m = String(s.text ?? ""), p = m.length ? m.split(/\r?\n/) : [];
2443
+ const c = i.shadowLines[r] ?? "", h = i.shadowLines[l] ?? "", f = Math.max(0, n.startColumn - 1), a = Math.max(0, n.endColumn - 1), u = C(c, f), d = C(h, a), m = String(s.text ?? ""), p = m.length ? m.split(/\r?\n/) : [];
2419
2444
  try {
2420
2445
  const b = Math.max(0, Number(s.rangeLength ?? 0) || 0);
2421
- r === a && !m.includes(`
2446
+ r === l && !m.includes(`
2422
2447
  `) ? (b > 0 && (this.dotRepeatBackspaces += b, this.dotRepeatKeys += "<BS>".repeat(b)), m && (this.dotRepeatKeys += L(m, !0)), this.dotRepeatKeys.length > 2e4 && (this.dotRepeatKeys = "", this.dotRepeatBackspaces = 0)) : (this.dotRepeatKeys = "", this.dotRepeatBackspaces = 0);
2423
2448
  } catch {
2424
2449
  }
2425
- i.pendingBufEdits.push({ startRow: r, startColByte: u, endRow: a, endColByte: d, lines: p }), ye(i.shadowLines, r, f, a, l, m), i.pendingCursorSync = !0;
2450
+ i.pendingBufEdits.push({ startRow: r, startColByte: u, endRow: l, endColByte: d, lines: p }), ye(i.shadowLines, r, f, l, a, m), i.pendingCursorSync = !0;
2426
2451
  const y = typeof performance < "u" && performance.now ? performance.now() : Date.now();
2427
2452
  this.ignoreNvimBufLinesUntil = y + Math.max(80, (this.opts.insertSyncDebounceMs || 20) * 4), this.scheduleFlushPendingMonacoSync();
2428
2453
  }
@@ -2473,7 +2498,7 @@ api.nvim_win_set_cursor(0, { b_line, b_col0 })
2473
2498
  const t = await this.rpcCall("nvim_get_api_info", []), e = Array.isArray(t) ? Number(t[0]) : NaN;
2474
2499
  if (!Number.isFinite(e) || e <= 0) return;
2475
2500
  this.nvimChannelId = e;
2476
- const i = this.opts.wrappedLineMotions ? "true" : "false", s = this.opts.scrollMotions ? "true" : "false", n = this.opts.syncScrolloff && this.opts.scrolloff == null ? "true" : "false", r = this.opts.hostCommands ? "true" : "false", a = `
2501
+ const i = this.opts.wrappedLineMotions ? "true" : "false", s = this.opts.scrollMotions ? "true" : "false", n = this.opts.syncScrolloff && this.opts.scrolloff == null ? "true" : "false", r = this.opts.hostCommands ? "true" : "false", l = `
2477
2502
  local chan = ...
2478
2503
  local api = vim.api
2479
2504
  vim.g.monaco_neovim_wasm_chan = chan
@@ -2561,7 +2586,7 @@ vim.rpcnotify(chan, "monaco_buf_enter", {
2561
2586
  filetype = (vim.bo[api.nvim_get_current_buf()] and vim.bo[api.nvim_get_current_buf()].filetype) or "",
2562
2587
  })
2563
2588
  `;
2564
- await this.execLua(a, [e]), this.hostAutocmdInstalled = !0;
2589
+ await this.execLua(l, [e]), this.hostAutocmdInstalled = !0;
2565
2590
  } catch {
2566
2591
  }
2567
2592
  }
@@ -2594,8 +2619,8 @@ vim.rpcnotify(chan, "monaco_buf_enter", {
2594
2619
  try {
2595
2620
  const r = await s.readFile(n);
2596
2621
  if (r == null) return;
2597
- const a = r instanceof Uint8Array ? new TextDecoder().decode(r) : String(r);
2598
- await this.openText({ path: n, text: a }), this.opts.status(`opened: ${n}`);
2622
+ const l = r instanceof Uint8Array ? new TextDecoder().decode(r) : String(r);
2623
+ await this.openText({ path: n, text: l }), this.opts.status(`opened: ${n}`);
2599
2624
  } catch (r) {
2600
2625
  this.opts.status(`edit failed: ${r?.message ?? r}`, !0);
2601
2626
  }
@@ -2603,21 +2628,21 @@ vim.rpcnotify(chan, "monaco_buf_enter", {
2603
2628
  }
2604
2629
  if (e === "write" || e === "wq") {
2605
2630
  const n = this.editor.getModel(), r = n ? n.getValue() : "";
2606
- let a = typeof i.path == "string" ? String(i.path) : "";
2607
- if (!a)
2631
+ let l = typeof i.path == "string" ? String(i.path) : "";
2632
+ if (!l)
2608
2633
  try {
2609
2634
  const c = await this.rpcCall("nvim_buf_get_name", [0]);
2610
- typeof c == "string" && (a = c);
2635
+ typeof c == "string" && (l = c);
2611
2636
  } catch {
2612
2637
  }
2613
- if (a || (a = this.opts.seedName), !s.writeFile) {
2638
+ if (l || (l = this.opts.seedName), !s.writeFile) {
2614
2639
  this.opts.status("write: fileSystem.writeFile not set", !0);
2615
2640
  return;
2616
2641
  }
2617
2642
  try {
2618
- await s.writeFile(a, r);
2643
+ await s.writeFile(l, r);
2619
2644
  try {
2620
- await this.rpcCall("nvim_buf_set_name", [0, a]);
2645
+ await this.rpcCall("nvim_buf_set_name", [0, l]);
2621
2646
  } catch {
2622
2647
  }
2623
2648
  try {
@@ -2625,7 +2650,7 @@ vim.rpcnotify(chan, "monaco_buf_enter", {
2625
2650
  } catch {
2626
2651
  }
2627
2652
  const c = this.getActiveState();
2628
- c && (c.name && c.name !== a && this.buffersByName.delete(c.name), c.name = a, this.buffersByName.set(a, c.id)), this.opts.status(`written: ${a}`), e === "wq" && this.opts.status("wq requested (provide onHostCommand to close the editor)");
2653
+ c && (c.name && c.name !== l && this.buffersByName.delete(c.name), c.name = l, this.buffersByName.set(l, c.id)), this.opts.status(`written: ${l}`), e === "wq" && this.opts.status("wq requested (provide onHostCommand to close the editor)");
2629
2654
  } catch (c) {
2630
2655
  this.opts.status(`write failed: ${c?.message ?? c}`, !0);
2631
2656
  }
@@ -2648,19 +2673,19 @@ vim.rpcnotify(chan, "monaco_buf_enter", {
2648
2673
  await this.rpcCall("nvim_buf_attach", [e, !1, {}]);
2649
2674
  } catch {
2650
2675
  }
2651
- let a = [""];
2676
+ let l = [""];
2652
2677
  try {
2653
2678
  const u = await this.rpcCall("nvim_buf_get_lines", [e, 0, -1, !1]);
2654
- Array.isArray(u) && (a = u.map((d) => String(d ?? "")));
2679
+ Array.isArray(u) && (l = u.map((d) => String(d ?? "")));
2655
2680
  } catch {
2656
2681
  }
2657
- const c = g.Uri.from({ scheme: "nvim", authority: "buf", path: `/${e}` }), h = a.join(`
2658
- `), f = s && g.languages.getLanguages().some((u) => u.id === s), l = g.editor.createModel(h, f ? s : void 0, c);
2682
+ const c = g.Uri.from({ scheme: "nvim", authority: "buf", path: `/${e}` }), h = l.join(`
2683
+ `), f = s && g.languages.getLanguages().some((u) => u.id === s), a = g.editor.createModel(h, f ? s : void 0, c);
2659
2684
  n = {
2660
2685
  id: e,
2661
2686
  name: i || "",
2662
2687
  filetype: s || "",
2663
- model: l,
2688
+ model: a,
2664
2689
  createdModel: !0,
2665
2690
  shadowLines: null,
2666
2691
  pendingBufEdits: [],
@@ -2704,7 +2729,7 @@ vim.rpcnotify(chan, "monaco_buf_enter", {
2704
2729
  if (!n)
2705
2730
  try {
2706
2731
  const r = await this.rpcCall("nvim_create_buf", [!0, !1]);
2707
- n = S(r) ?? Number(r);
2732
+ n = x(r) ?? Number(r);
2708
2733
  } catch {
2709
2734
  n = null;
2710
2735
  }
@@ -2762,8 +2787,8 @@ vim.rpcnotify(chan, "monaco_buf_enter", {
2762
2787
  updateCursor(t, e) {
2763
2788
  const i = this.editor.getModel(), s = Math.max(1, Number(t) || 1), n = Math.max(1, Number(e) || 1), r = i ? i.validatePosition(new g.Position(s, n)) : new g.Position(s, n);
2764
2789
  if (this.lastCursorPos = r, this.compositionActive) return;
2765
- const a = this.editor.getPosition();
2766
- a && a.lineNumber === r.lineNumber && a.column === r.column || (this.suppressCursorSync = !0, this.editor.setPosition(this.lastCursorPos), this.visualSelectionActive && this.editor.setSelection(new g.Selection(r.lineNumber, r.column, r.lineNumber, r.column)), this.applyScrolloff(this.lastCursorPos) || this.editor.revealPositionInCenterIfOutsideViewport(this.lastCursorPos), this.suppressCursorSync = !1), this.scheduleSearchHighlightRefresh();
2790
+ const l = this.editor.getPosition();
2791
+ l && l.lineNumber === r.lineNumber && l.column === r.column || (this.suppressCursorSync = !0, this.editor.setPosition(this.lastCursorPos), this.visualSelectionActive && this.editor.setSelection(new g.Selection(r.lineNumber, r.column, r.lineNumber, r.column)), this.applyScrolloff(this.lastCursorPos) || this.editor.revealPositionInCenterIfOutsideViewport(this.lastCursorPos), this.suppressCursorSync = !1), this.scheduleSearchHighlightRefresh();
2767
2792
  }
2768
2793
  scheduleCursorRefresh() {
2769
2794
  if (this.compositionActive || this.cursorRefreshTimer) return;
@@ -2787,8 +2812,8 @@ vim.rpcnotify(chan, "monaco_buf_enter", {
2787
2812
  try {
2788
2813
  const e = await this.rpcCall("nvim_win_get_cursor", [0]);
2789
2814
  if (Array.isArray(e) && e.length >= 2) {
2790
- const i = Number(e[0]), s = Number(e[1]), n = B(this.editor, i, s), r = new g.Position(n.line, n.col), a = typeof performance < "u" && performance.now ? performance.now() : Date.now();
2791
- if (this.optimisticCursorPos && this.optimisticCursorUntil > a) {
2815
+ const i = Number(e[0]), s = Number(e[1]), n = B(this.editor, i, s), r = new g.Position(n.line, n.col), l = typeof performance < "u" && performance.now ? performance.now() : Date.now();
2816
+ if (this.optimisticCursorPos && this.optimisticCursorUntil > l) {
2792
2817
  const c = this.optimisticCursorPrevPos;
2793
2818
  c && r.lineNumber === c.lineNumber && r.column === c.column || r.lineNumber < this.optimisticCursorPos.lineNumber || r.lineNumber === this.optimisticCursorPos.lineNumber && r.column < this.optimisticCursorPos.column || (this.optimisticCursorPos = null, this.optimisticCursorPrevPos = null, this.optimisticCursorUntil = 0, this.updateCursor(r.lineNumber, r.column));
2794
2819
  } else
@@ -2814,7 +2839,7 @@ vim.rpcnotify(chan, "monaco_buf_enter", {
2814
2839
  s === this.lastCursorStyle && n === this.lastCursorBlink && r === this.lastCursorWidth || (this.editor.updateOptions({ cursorStyle: s, cursorBlinking: n, cursorWidth: r }), this.lastCursorStyle = s, this.lastCursorBlink = n, this.lastCursorWidth = r);
2815
2840
  }
2816
2841
  async updateVisualSelection(t) {
2817
- const e = I(t), i = ++this.visualSelectionToken;
2842
+ const e = v(t), i = ++this.visualSelectionToken;
2818
2843
  if (!e) {
2819
2844
  this.clearVisualDecorations();
2820
2845
  return;
@@ -2859,7 +2884,7 @@ vim.rpcnotify(chan, "monaco_buf_enter", {
2859
2884
  return null;
2860
2885
  }
2861
2886
  async seedBuffer(t, e) {
2862
- const i = S(t);
2887
+ const i = x(t);
2863
2888
  if (!i || i <= 0) return null;
2864
2889
  const s = e ?? this.opts.seedLines;
2865
2890
  if (!s || !s.length) return null;
@@ -2871,9 +2896,9 @@ vim.rpcnotify(chan, "monaco_buf_enter", {
2871
2896
  }
2872
2897
  }
2873
2898
  function _e(o, t = {}) {
2874
- return new le(o, t);
2899
+ return new ae(o, t);
2875
2900
  }
2876
- function M(o, t, e) {
2901
+ function I(o, t, e) {
2877
2902
  return Math.min(Math.max(o, t), e);
2878
2903
  }
2879
2904
  function k(o) {
@@ -2887,8 +2912,8 @@ function B(o, t, e) {
2887
2912
  const i = Math.max(1, Number(t) || 1), s = Math.max(1, (Number(e) || 0) + 1), n = o.getModel();
2888
2913
  if (!n)
2889
2914
  return { line: i, col: s };
2890
- const r = n.getLineCount(), a = M(i, 1, r), c = n.getLineContent(a) ?? "", h = n.getLineMaxColumn(a), f = Math.max(0, Number(e) || 0), l = v(c, f), u = M(l + 1, 1, h);
2891
- return { line: a, col: u };
2915
+ const r = n.getLineCount(), l = I(i, 1, r), c = n.getLineContent(l) ?? "", h = n.getLineMaxColumn(l), f = Math.max(0, Number(e) || 0), a = w(c, f), u = I(a + 1, 1, h);
2916
+ return { line: l, col: u };
2892
2917
  }
2893
2918
  function L(o, t = !0) {
2894
2919
  const e = String(o ?? "");
@@ -2901,10 +2926,10 @@ function L(o, t = !0) {
2901
2926
  function ce(o) {
2902
2927
  const t = o.key;
2903
2928
  if (!t || t === "Dead" || t === "Unidentified") return null;
2904
- const e = !!o.getModifierState?.("AltGraph"), i = o.ctrlKey && !e, s = o.altKey && !e, n = o.metaKey && !e, r = o.shiftKey, a = (l) => l === "<" ? "lt" : l, c = (l) => l === "<" ? "<lt>" : l, h = (l, u = !1) => {
2929
+ const e = !!o.getModifierState?.("AltGraph"), i = o.ctrlKey && !e, s = o.altKey && !e, n = o.metaKey && !e, r = o.shiftKey, l = (a) => a === "<" ? "lt" : a, c = (a) => a === "<" ? "<lt>" : a, h = (a, u = !1) => {
2905
2930
  const d = [];
2906
2931
  i && d.push("C-"), u && r && d.push("S-"), s && d.push("A-"), n && d.push("D-");
2907
- const m = a(l);
2932
+ const m = l(a);
2908
2933
  return d.length ? `<${d.join("")}${m}>` : `<${m}>`;
2909
2934
  };
2910
2935
  if (typeof o.code == "string" && o.code.startsWith("Numpad") || typeof KeyboardEvent?.DOM_KEY_LOCATION_NUMPAD == "number" && o.location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD) {
@@ -2958,7 +2983,7 @@ function ce(o) {
2958
2983
  if (t.length === 1) {
2959
2984
  if (!i && !s && !n) return c(t);
2960
2985
  if (t === " " && i && !s && !n) return "<Nul>";
2961
- const l = /^[A-Za-z]$/.test(t) ? t.toLowerCase() : t, u = a(l);
2986
+ const a = /^[A-Za-z]$/.test(t) ? t.toLowerCase() : t, u = l(a);
2962
2987
  return `<${(i ? "C-" : "") + (s ? "A-" : "") + (n ? "D-" : "")}${u}>`;
2963
2988
  }
2964
2989
  return null;
@@ -2993,7 +3018,7 @@ function ue(o) {
2993
3018
  function he(o) {
2994
3019
  return o instanceof Uint8Array ? o : o instanceof ArrayBuffer ? new Uint8Array(o) : Array.isArray(o) ? new Uint8Array(o) : Number.isInteger(o) ? new Uint8Array([o & 255]) : o && o.type === "Buffer" && Array.isArray(o.data) ? new Uint8Array(o.data) : null;
2995
3020
  }
2996
- function S(o) {
3021
+ function x(o) {
2997
3022
  if (o && typeof o == "object" && typeof o.type == "number") {
2998
3023
  const e = he(o.data);
2999
3024
  if (e) {
@@ -3004,7 +3029,7 @@ function S(o) {
3004
3029
  const t = Number(o);
3005
3030
  return Number.isInteger(t) && t > 0 ? t : null;
3006
3031
  }
3007
- function v(o, t) {
3032
+ function w(o, t) {
3008
3033
  let e = 0, i = 0;
3009
3034
  const s = Math.max(0, Number(t) || 0);
3010
3035
  for (; e < s; ) {
@@ -3036,24 +3061,24 @@ function de(o) {
3036
3061
  }
3037
3062
  function F(o, t, e) {
3038
3063
  if (!t || typeof t.line != "number" || typeof t.col != "number") return null;
3039
- const i = o.getModel(), s = M(t.line + 1, 1, i?.getLineCount() || 1 / 0);
3064
+ const i = o.getModel(), s = I(t.line + 1, 1, i?.getLineCount() || 1 / 0);
3040
3065
  if (!i) {
3041
3066
  const f = Math.max(1, t.col + 1);
3042
3067
  return { lineNumber: s, column: f + (e ? 1 : 0) };
3043
3068
  }
3044
3069
  const n = i.getLineContent(s) ?? "", r = Math.max(0, Number(t.col) || 0);
3045
- let a = r;
3070
+ let l = r;
3046
3071
  if (e) {
3047
- const f = v(n, r);
3072
+ const f = w(n, r);
3048
3073
  if (f < n.length) {
3049
- const l = n.codePointAt(f);
3050
- a = r + P(l ?? 0);
3074
+ const a = n.codePointAt(f);
3075
+ l = r + P(a ?? 0);
3051
3076
  }
3052
3077
  }
3053
- const c = v(n, a) + 1, h = i.getLineMaxColumn(s);
3054
- return { lineNumber: s, column: M(c, 1, h) };
3078
+ const c = w(n, l) + 1, h = i.getLineMaxColumn(s);
3079
+ return { lineNumber: s, column: I(c, 1, h) };
3055
3080
  }
3056
- function I(o) {
3081
+ function v(o) {
3057
3082
  const t = typeof o == "string" ? o : "";
3058
3083
  return t.includes("v") || t.includes("V") || t.includes("") || t.includes("s") || t.includes("S") || t.includes("");
3059
3084
  }
@@ -3076,7 +3101,7 @@ function me(o, t) {
3076
3101
  function H(o, t) {
3077
3102
  const e = o.replace("#", "");
3078
3103
  if (e.length !== 6) return o;
3079
- const i = Math.round(M(t, 0, 1) * 255);
3104
+ const i = Math.round(I(t, 0, 1) * 255);
3080
3105
  return `#${e}${i.toString(16).padStart(2, "0")}`;
3081
3106
  }
3082
3107
  function K(o) {
@@ -3098,17 +3123,17 @@ function ge(o) {
3098
3123
  const t = typeof o == "string" ? o : "";
3099
3124
  return t.length ? t[t.length - 1] : "";
3100
3125
  }
3101
- function x(o) {
3126
+ function M(o) {
3102
3127
  const t = typeof o == "string" ? o : "";
3103
3128
  return t === "c" || t.startsWith("c");
3104
3129
  }
3105
3130
  function ye(o, t, e, i, s, n) {
3106
- const r = o[t] ?? "", a = o[i] ?? "", c = r.slice(0, Math.max(0, e)), h = a.slice(Math.max(0, s)), l = String(n ?? "").split(/\r?\n/);
3131
+ const r = o[t] ?? "", l = o[i] ?? "", c = r.slice(0, Math.max(0, e)), h = l.slice(Math.max(0, s)), a = String(n ?? "").split(/\r?\n/);
3107
3132
  let u;
3108
- if (l.length <= 1)
3109
- u = [`${c}${l[0] ?? ""}${h}`];
3133
+ if (a.length <= 1)
3134
+ u = [`${c}${a[0] ?? ""}${h}`];
3110
3135
  else {
3111
- const d = `${c}${l[0] ?? ""}`, m = `${l[l.length - 1] ?? ""}${h}`, p = l.slice(1, -1);
3136
+ const d = `${c}${a[0] ?? ""}`, m = `${a[a.length - 1] ?? ""}${h}`, p = a.slice(1, -1);
3112
3137
  u = [d, ...p, m];
3113
3138
  }
3114
3139
  o.splice(t, Math.max(0, i - t + 1), ...u);
@@ -3153,7 +3178,7 @@ function be(o) {
3153
3178
  }
3154
3179
  const Ce = new URL("./nvimWorker.js", import.meta.url), ve = new URL("./nvimWorkerAsyncify.js", import.meta.url);
3155
3180
  export {
3156
- le as MonacoNeovimClient,
3181
+ ae as MonacoNeovimClient,
3157
3182
  te as NeovimWasmSession,
3158
3183
  _e as createMonacoNeovim,
3159
3184
  Ce as defaultWorkerUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monaco-neovim-wasm/lib",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Core library for running Neovim (WASM) behind Monaco via msgpack-RPC.",