@fairyhunter13/opentui-core 0.1.120 → 0.1.122

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.
@@ -5788,6 +5788,18 @@ var isShiftKey = (code) => {
5788
5788
  var isCtrlKey = (code) => {
5789
5789
  return ["Oa", "Ob", "Oc", "Od", "Oe", "[2^", "[3^", "[5^", "[6^", "[7^", "[8^"].includes(code);
5790
5790
  };
5791
+ var getCtrlKeyName = (charCode) => {
5792
+ if (charCode === 0) {
5793
+ return "space";
5794
+ }
5795
+ if (charCode >= 1 && charCode <= 26) {
5796
+ return String.fromCharCode(charCode + 97 - 1);
5797
+ }
5798
+ if (charCode >= 28 && charCode <= 31) {
5799
+ return String.fromCharCode(charCode + 64);
5800
+ }
5801
+ return;
5802
+ };
5791
5803
  var modifyOtherKeysRe = /^\x1b\[27;(\d+);(\d+)~$/;
5792
5804
  var parseKeypress = (s = "", options = {}) => {
5793
5805
  let parts;
@@ -5852,6 +5864,8 @@ var parseKeypress = (s = "", options = {}) => {
5852
5864
  source: "raw"
5853
5865
  };
5854
5866
  key.sequence = key.sequence || s || key.name;
5867
+ const ctrlKeyName = s.length === 1 ? getCtrlKeyName(s.charCodeAt(0)) : undefined;
5868
+ const metaCtrlKeyName = s.length === 2 && s[0] === "\x1B" ? getCtrlKeyName(s.charCodeAt(1)) : undefined;
5855
5869
  if (options.useKittyKeyboard) {
5856
5870
  const kittyResult = parseKittyKeyboard(s);
5857
5871
  if (kittyResult) {
@@ -5907,11 +5921,8 @@ var parseKeypress = (s = "", options = {}) => {
5907
5921
  } else if (s === " " || s === "\x1B ") {
5908
5922
  key.name = "space";
5909
5923
  key.meta = s.length === 2;
5910
- } else if (s === "\x00") {
5911
- key.name = "space";
5912
- key.ctrl = true;
5913
- } else if (s.length === 1 && s <= "\x1A") {
5914
- key.name = String.fromCharCode(s.charCodeAt(0) + 97 - 1);
5924
+ } else if (ctrlKeyName) {
5925
+ key.name = ctrlKeyName;
5915
5926
  key.ctrl = true;
5916
5927
  } else if (s.length === 1 && s >= "0" && s <= "9") {
5917
5928
  key.name = s;
@@ -5937,10 +5948,10 @@ var parseKeypress = (s = "", options = {}) => {
5937
5948
  } else {
5938
5949
  key.name = char;
5939
5950
  }
5940
- } else if (s.length === 2 && s[0] === "\x1B" && s[1] <= "\x1A") {
5951
+ } else if (metaCtrlKeyName) {
5941
5952
  key.meta = true;
5942
5953
  key.ctrl = true;
5943
- key.name = String.fromCharCode(s.charCodeAt(1) + 97 - 1);
5954
+ key.name = metaCtrlKeyName;
5944
5955
  } else if (parts = fnKeyRe.exec(s)) {
5945
5956
  const segs = [...s];
5946
5957
  if (segs[0] === "\x1B" && segs[1] === "\x1B") {
@@ -8457,7 +8468,19 @@ class ProcessQueue {
8457
8468
  }
8458
8469
 
8459
8470
  // src/lib/tree-sitter/default-parsers.ts
8471
+ import { resolve, dirname } from "path";
8460
8472
  import { fileURLToPath } from "url";
8473
+ import javascript_highlights from "./assets/javascript/highlights.scm" with { type: "file" };
8474
+ import javascript_language from "./assets/javascript/tree-sitter-javascript.wasm" with { type: "file" };
8475
+ import typescript_highlights from "./assets/typescript/highlights.scm" with { type: "file" };
8476
+ import typescript_language from "./assets/typescript/tree-sitter-typescript.wasm" with { type: "file" };
8477
+ import markdown_highlights from "./assets/markdown/highlights.scm" with { type: "file" };
8478
+ import markdown_language from "./assets/markdown/tree-sitter-markdown.wasm" with { type: "file" };
8479
+ import markdown_injections from "./assets/markdown/injections.scm" with { type: "file" };
8480
+ import markdown_inline_highlights from "./assets/markdown_inline/highlights.scm" with { type: "file" };
8481
+ import markdown_inline_language from "./assets/markdown_inline/tree-sitter-markdown_inline.wasm" with { type: "file" };
8482
+ import zig_highlights from "./assets/zig/highlights.scm" with { type: "file" };
8483
+ import zig_language from "./assets/zig/tree-sitter-zig.wasm" with { type: "file" };
8461
8484
  var _cachedParsers;
8462
8485
  function getParsers() {
8463
8486
  if (!_cachedParsers) {
@@ -8466,25 +8489,25 @@ function getParsers() {
8466
8489
  filetype: "javascript",
8467
8490
  aliases: ["javascriptreact"],
8468
8491
  queries: {
8469
- highlights: [fileURLToPath(new URL("./assets/javascript/highlights.scm", import.meta.url))]
8492
+ highlights: [resolve(dirname(fileURLToPath(import.meta.url)), javascript_highlights)]
8470
8493
  },
8471
- wasm: fileURLToPath(new URL("./assets/javascript/tree-sitter-javascript.wasm", import.meta.url))
8494
+ wasm: resolve(dirname(fileURLToPath(import.meta.url)), javascript_language)
8472
8495
  },
8473
8496
  {
8474
8497
  filetype: "typescript",
8475
8498
  aliases: ["typescriptreact"],
8476
8499
  queries: {
8477
- highlights: [fileURLToPath(new URL("./assets/typescript/highlights.scm", import.meta.url))]
8500
+ highlights: [resolve(dirname(fileURLToPath(import.meta.url)), typescript_highlights)]
8478
8501
  },
8479
- wasm: fileURLToPath(new URL("./assets/typescript/tree-sitter-typescript.wasm", import.meta.url))
8502
+ wasm: resolve(dirname(fileURLToPath(import.meta.url)), typescript_language)
8480
8503
  },
8481
8504
  {
8482
8505
  filetype: "markdown",
8483
8506
  queries: {
8484
- highlights: [fileURLToPath(new URL("./assets/markdown/highlights.scm", import.meta.url))],
8485
- injections: [fileURLToPath(new URL("./assets/markdown/injections.scm", import.meta.url))]
8507
+ highlights: [resolve(dirname(fileURLToPath(import.meta.url)), markdown_highlights)],
8508
+ injections: [resolve(dirname(fileURLToPath(import.meta.url)), markdown_injections)]
8486
8509
  },
8487
- wasm: fileURLToPath(new URL("./assets/markdown/tree-sitter-markdown.wasm", import.meta.url)),
8510
+ wasm: resolve(dirname(fileURLToPath(import.meta.url)), markdown_language),
8488
8511
  injectionMapping: {
8489
8512
  nodeTypes: {
8490
8513
  inline: "markdown_inline",
@@ -8507,16 +8530,16 @@ function getParsers() {
8507
8530
  {
8508
8531
  filetype: "markdown_inline",
8509
8532
  queries: {
8510
- highlights: [fileURLToPath(new URL("./assets/markdown_inline/highlights.scm", import.meta.url))]
8533
+ highlights: [resolve(dirname(fileURLToPath(import.meta.url)), markdown_inline_highlights)]
8511
8534
  },
8512
- wasm: fileURLToPath(new URL("./assets/markdown_inline/tree-sitter-markdown_inline.wasm", import.meta.url))
8535
+ wasm: resolve(dirname(fileURLToPath(import.meta.url)), markdown_inline_language)
8513
8536
  },
8514
8537
  {
8515
8538
  filetype: "zig",
8516
8539
  queries: {
8517
- highlights: [fileURLToPath(new URL("./assets/zig/highlights.scm", import.meta.url))]
8540
+ highlights: [resolve(dirname(fileURLToPath(import.meta.url)), zig_highlights)]
8518
8541
  },
8519
- wasm: fileURLToPath(new URL("./assets/zig/tree-sitter-zig.wasm", import.meta.url))
8542
+ wasm: resolve(dirname(fileURLToPath(import.meta.url)), zig_language)
8520
8543
  }
8521
8544
  ];
8522
8545
  }
@@ -8524,7 +8547,7 @@ function getParsers() {
8524
8547
  }
8525
8548
 
8526
8549
  // src/lib/tree-sitter/client.ts
8527
- import { resolve, isAbsolute, parse } from "path";
8550
+ import { resolve as resolve2, isAbsolute, parse } from "path";
8528
8551
  import { existsSync } from "fs";
8529
8552
 
8530
8553
  // src/lib/bunfs.ts
@@ -8597,7 +8620,7 @@ class TreeSitterClient extends EventEmitter2 {
8597
8620
  worker_path = this.options.workerPath;
8598
8621
  } else {
8599
8622
  worker_path = new URL("./parser.worker.js", import.meta.url).href;
8600
- if (!existsSync(resolve(import.meta.dirname, "parser.worker.js"))) {
8623
+ if (!existsSync(resolve2(import.meta.dirname, "parser.worker.js"))) {
8601
8624
  worker_path = new URL("./parser.worker.ts", import.meta.url).href;
8602
8625
  }
8603
8626
  }
@@ -8632,7 +8655,7 @@ class TreeSitterClient extends EventEmitter2 {
8632
8655
  if (this.initializePromise) {
8633
8656
  return this.initializePromise;
8634
8657
  }
8635
- this.initializePromise = new Promise((resolve2, reject) => {
8658
+ this.initializePromise = new Promise((resolve3, reject) => {
8636
8659
  const timeoutMs = this.options.initTimeout ?? 1e4;
8637
8660
  const timeoutId = setTimeout(() => {
8638
8661
  const error = new Error("Worker initialization timed out");
@@ -8640,7 +8663,7 @@ class TreeSitterClient extends EventEmitter2 {
8640
8663
  this.initializeResolvers = undefined;
8641
8664
  reject(error);
8642
8665
  }, timeoutMs);
8643
- this.initializeResolvers = { resolve: resolve2, reject, timeoutId };
8666
+ this.initializeResolvers = { resolve: resolve3, reject, timeoutId };
8644
8667
  this.worker?.postMessage({
8645
8668
  type: "INIT",
8646
8669
  dataPath: this.options.dataPath
@@ -8663,7 +8686,7 @@ class TreeSitterClient extends EventEmitter2 {
8663
8686
  return normalizeBunfsPath(parse(path).base);
8664
8687
  }
8665
8688
  if (!isAbsolute(path)) {
8666
- return resolve(path);
8689
+ return resolve2(path);
8667
8690
  }
8668
8691
  return path;
8669
8692
  }
@@ -8681,8 +8704,8 @@ class TreeSitterClient extends EventEmitter2 {
8681
8704
  }
8682
8705
  async getPerformance() {
8683
8706
  const messageId = `performance_${this.messageIdCounter++}`;
8684
- return new Promise((resolve2) => {
8685
- this.messageCallbacks.set(messageId, resolve2);
8707
+ return new Promise((resolve3) => {
8708
+ this.messageCallbacks.set(messageId, resolve3);
8686
8709
  this.worker?.postMessage({ type: "GET_PERFORMANCE", messageId });
8687
8710
  });
8688
8711
  }
@@ -8695,8 +8718,8 @@ class TreeSitterClient extends EventEmitter2 {
8695
8718
  }
8696
8719
  }
8697
8720
  const messageId = `oneshot_${this.messageIdCounter++}`;
8698
- return new Promise((resolve2) => {
8699
- this.messageCallbacks.set(messageId, resolve2);
8721
+ return new Promise((resolve3) => {
8722
+ this.messageCallbacks.set(messageId, resolve3);
8700
8723
  this.worker?.postMessage({
8701
8724
  type: "ONESHOT_HIGHLIGHT",
8702
8725
  content,
@@ -8805,8 +8828,8 @@ class TreeSitterClient extends EventEmitter2 {
8805
8828
  }
8806
8829
  async preloadParser(filetype) {
8807
8830
  const messageId = `has_parser_${this.messageIdCounter++}`;
8808
- const response = await new Promise((resolve2) => {
8809
- this.messageCallbacks.set(messageId, resolve2);
8831
+ const response = await new Promise((resolve3) => {
8832
+ this.messageCallbacks.set(messageId, resolve3);
8810
8833
  this.worker?.postMessage({
8811
8834
  type: "PRELOAD_PARSER",
8812
8835
  filetype,
@@ -8833,8 +8856,8 @@ class TreeSitterClient extends EventEmitter2 {
8833
8856
  }
8834
8857
  this.buffers.set(id, { id, content, filetype, version, hasParser: false });
8835
8858
  const messageId = `init_${this.messageIdCounter++}`;
8836
- const response = await new Promise((resolve2) => {
8837
- this.messageCallbacks.set(messageId, resolve2);
8859
+ const response = await new Promise((resolve3) => {
8860
+ this.messageCallbacks.set(messageId, resolve3);
8838
8861
  this.worker?.postMessage({
8839
8862
  type: "INITIALIZE_PARSER",
8840
8863
  bufferId: id,
@@ -8890,9 +8913,9 @@ class TreeSitterClient extends EventEmitter2 {
8890
8913
  this.editQueues.delete(bufferId);
8891
8914
  }
8892
8915
  if (this.worker) {
8893
- await new Promise((resolve2) => {
8916
+ await new Promise((resolve3) => {
8894
8917
  const messageId = `dispose_${bufferId}`;
8895
- this.messageCallbacks.set(messageId, resolve2);
8918
+ this.messageCallbacks.set(messageId, resolve3);
8896
8919
  try {
8897
8920
  this.worker.postMessage({
8898
8921
  type: "DISPOSE_BUFFER",
@@ -8900,13 +8923,13 @@ class TreeSitterClient extends EventEmitter2 {
8900
8923
  });
8901
8924
  } catch (error) {
8902
8925
  console.error("Error disposing buffer", error);
8903
- resolve2(false);
8926
+ resolve3(false);
8904
8927
  }
8905
8928
  setTimeout(() => {
8906
8929
  if (this.messageCallbacks.has(messageId)) {
8907
8930
  this.messageCallbacks.delete(messageId);
8908
8931
  console.warn({ bufferId }, "Timed out waiting for buffer to be disposed");
8909
- resolve2(false);
8932
+ resolve3(false);
8910
8933
  }
8911
8934
  }, 3000);
8912
8935
  });
@@ -8963,12 +8986,12 @@ class TreeSitterClient extends EventEmitter2 {
8963
8986
  this.options.dataPath = dataPath;
8964
8987
  if (this.initialized && this.worker) {
8965
8988
  const messageId = `update_datapath_${this.messageIdCounter++}`;
8966
- return new Promise((resolve2, reject) => {
8989
+ return new Promise((resolve3, reject) => {
8967
8990
  this.messageCallbacks.set(messageId, (response) => {
8968
8991
  if (response.error) {
8969
8992
  reject(new Error(response.error));
8970
8993
  } else {
8971
- resolve2();
8994
+ resolve3();
8972
8995
  }
8973
8996
  });
8974
8997
  this.worker.postMessage({
@@ -8984,12 +9007,12 @@ class TreeSitterClient extends EventEmitter2 {
8984
9007
  throw new Error("Cannot clear cache: client is not initialized");
8985
9008
  }
8986
9009
  const messageId = `clear_cache_${this.messageIdCounter++}`;
8987
- return new Promise((resolve2, reject) => {
9010
+ return new Promise((resolve3, reject) => {
8988
9011
  this.messageCallbacks.set(messageId, (response) => {
8989
9012
  if (response.error) {
8990
9013
  reject(new Error(response.error));
8991
9014
  } else {
8992
- resolve2();
9015
+ resolve3();
8993
9016
  }
8994
9017
  });
8995
9018
  this.worker.postMessage({
@@ -9515,13 +9538,26 @@ ${content}`);
9515
9538
  return "./" + path4.relative(path4.dirname(outputPath), queryPath);
9516
9539
  }
9517
9540
  async function generateDefaultParsersFile(parsers, outputPath) {
9541
+ const imports = parsers.map((parser) => {
9542
+ const safeFiletype = parser.filetype.replace(/[^a-zA-Z0-9]/g, "_");
9543
+ const lines = [
9544
+ `import ${safeFiletype}_highlights from "${parser.highlightsPath}" with { type: "file" }`,
9545
+ `import ${safeFiletype}_language from "${parser.languagePath}" with { type: "file" }`
9546
+ ];
9547
+ if (parser.injectionsPath) {
9548
+ lines.push(`import ${safeFiletype}_injections from "${parser.injectionsPath}" with { type: "file" }`);
9549
+ }
9550
+ return lines.join(`
9551
+ `);
9552
+ }).join(`
9553
+ `);
9518
9554
  const parserDefinitions = parsers.map((parser) => {
9519
9555
  const safeFiletype = parser.filetype.replace(/[^a-zA-Z0-9]/g, "_");
9520
9556
  const queriesLines = [
9521
- ` highlights: [fileURLToPath(new URL("${parser.highlightsPath}", import.meta.url))],`
9557
+ ` highlights: [resolve(dirname(fileURLToPath(import.meta.url)), ${safeFiletype}_highlights)],`
9522
9558
  ];
9523
9559
  if (parser.injectionsPath) {
9524
- queriesLines.push(` injections: [fileURLToPath(new URL("${parser.injectionsPath}", import.meta.url))],`);
9560
+ queriesLines.push(` injections: [resolve(dirname(fileURLToPath(import.meta.url)), ${safeFiletype}_injections)],`);
9525
9561
  }
9526
9562
  const injectionMappingLine = parser.injectionMapping ? ` injectionMapping: ${JSON.stringify(parser.injectionMapping, null, 10)},` : "";
9527
9563
  const aliasesLine = parser.aliases?.length ? ` aliases: ${JSON.stringify(parser.aliases)},` : "";
@@ -9532,7 +9568,7 @@ ${aliasesLine ? aliasesLine + `
9532
9568
  ${queriesLines.join(`
9533
9569
  `)}
9534
9570
  },
9535
- wasm: fileURLToPath(new URL("${parser.languagePath}", import.meta.url)),${injectionMappingLine ? `
9571
+ wasm: resolve(dirname(fileURLToPath(import.meta.url)), ${safeFiletype}_language),${injectionMappingLine ? `
9536
9572
  ` + injectionMappingLine : ""}
9537
9573
  }`;
9538
9574
  }).join(`,
@@ -9542,8 +9578,11 @@ ${queriesLines.join(`
9542
9578
  // Last generated: ${new Date().toISOString()}
9543
9579
 
9544
9580
  import type { FiletypeParserOptions } from "./types"
9581
+ import { resolve, dirname } from "path"
9545
9582
  import { fileURLToPath } from "url"
9546
9583
 
9584
+ ${imports}
9585
+
9547
9586
  // Cached parsers to avoid re-resolving paths on every call
9548
9587
  let _cachedParsers: FiletypeParserOptions[] | undefined
9549
9588
 
@@ -10435,7 +10474,7 @@ class TerminalPalette {
10435
10474
  const out = this.stdout;
10436
10475
  if (!out.isTTY || !this.stdin.isTTY)
10437
10476
  return false;
10438
- return new Promise((resolve3) => {
10477
+ return new Promise((resolve4) => {
10439
10478
  const session = this.createQuerySession();
10440
10479
  let buffer = "";
10441
10480
  let settled = false;
@@ -10444,7 +10483,7 @@ class TerminalPalette {
10444
10483
  return;
10445
10484
  settled = true;
10446
10485
  session.cleanup();
10447
- resolve3(supported);
10486
+ resolve4(supported);
10448
10487
  };
10449
10488
  const onData = (chunk) => {
10450
10489
  buffer += chunk.toString();
@@ -10467,7 +10506,7 @@ class TerminalPalette {
10467
10506
  if (!out.isTTY || !this.stdin.isTTY) {
10468
10507
  return results;
10469
10508
  }
10470
- return new Promise((resolve3) => {
10509
+ return new Promise((resolve4) => {
10471
10510
  const session = this.createQuerySession();
10472
10511
  let buffer = "";
10473
10512
  let idleTimer = null;
@@ -10477,7 +10516,7 @@ class TerminalPalette {
10477
10516
  return;
10478
10517
  settled = true;
10479
10518
  session.cleanup();
10480
- resolve3(results);
10519
+ resolve4(results);
10481
10520
  };
10482
10521
  const onData = (chunk) => {
10483
10522
  buffer += chunk.toString();
@@ -10518,7 +10557,7 @@ class TerminalPalette {
10518
10557
  if (!out.isTTY || !this.stdin.isTTY) {
10519
10558
  return results;
10520
10559
  }
10521
- return new Promise((resolve3) => {
10560
+ return new Promise((resolve4) => {
10522
10561
  const session = this.createQuerySession();
10523
10562
  let buffer = "";
10524
10563
  let idleTimer = null;
@@ -10528,7 +10567,7 @@ class TerminalPalette {
10528
10567
  return;
10529
10568
  settled = true;
10530
10569
  session.cleanup();
10531
- resolve3(results);
10570
+ resolve4(results);
10532
10571
  };
10533
10572
  const onData = (chunk) => {
10534
10573
  buffer += chunk.toString();
@@ -14610,6 +14649,8 @@ class Renderable extends BaseRenderable {
14610
14649
  _translateY = 0;
14611
14650
  _x = 0;
14612
14651
  _y = 0;
14652
+ _screenX = 0;
14653
+ _screenY = 0;
14613
14654
  _width;
14614
14655
  _height;
14615
14656
  _widthValue = 0;
@@ -14849,6 +14890,8 @@ class Renderable extends BaseRenderable {
14849
14890
  if (this._translateX === value)
14850
14891
  return;
14851
14892
  this._translateX = value;
14893
+ const parentScreenX = this.parent ? this.parent._screenX : 0;
14894
+ this._screenX = parentScreenX + this._x + this._translateX;
14852
14895
  if (this.parent)
14853
14896
  this.parent.childrenPrimarySortDirty = true;
14854
14897
  this.requestRender();
@@ -14860,10 +14903,20 @@ class Renderable extends BaseRenderable {
14860
14903
  if (this._translateY === value)
14861
14904
  return;
14862
14905
  this._translateY = value;
14906
+ const parentScreenY = this.parent ? this.parent._screenY : 0;
14907
+ this._screenY = parentScreenY + this._y + this._translateY;
14863
14908
  if (this.parent)
14864
14909
  this.parent.childrenPrimarySortDirty = true;
14865
14910
  this.requestRender();
14866
14911
  }
14912
+ get screenX() {
14913
+ const parentScreenX = this.parent ? this.parent._screenX : 0;
14914
+ return parentScreenX + this._x + this._translateX;
14915
+ }
14916
+ get screenY() {
14917
+ const parentScreenY = this.parent ? this.parent._screenY : 0;
14918
+ return parentScreenY + this._y + this._translateY;
14919
+ }
14867
14920
  get x() {
14868
14921
  if (this.parent) {
14869
14922
  return this.parent.x + this._x + this._translateX;
@@ -14971,8 +15024,8 @@ class Renderable extends BaseRenderable {
14971
15024
  const axis = dir === 2 || dir === 3 ? "x" : "y";
14972
15025
  const sorted = [...this._childrenInLayoutOrder];
14973
15026
  sorted.sort((a, b) => {
14974
- const va = axis === "y" ? a.y : a.x;
14975
- const vb = axis === "y" ? b.y : b.x;
15027
+ const va = axis === "y" ? a.screenY : a.screenX;
15028
+ const vb = axis === "y" ? b.screenY : b.screenX;
14976
15029
  return va - vb;
14977
15030
  });
14978
15031
  this.childrenSortedByPrimaryAxis = sorted;
@@ -15301,6 +15354,10 @@ class Renderable extends BaseRenderable {
15301
15354
  const oldHeight = this._heightValue;
15302
15355
  this._x = layout.left;
15303
15356
  this._y = layout.top;
15357
+ const parentScreenX = this.parent ? this.parent._screenX : 0;
15358
+ const parentScreenY = this.parent ? this.parent._screenY : 0;
15359
+ this._screenX = parentScreenX + this._x + this._translateX;
15360
+ this._screenY = parentScreenY + this._y + this._translateY;
15304
15361
  const newWidth = Math.max(layout.width, 1);
15305
15362
  const newHeight = Math.max(layout.height, 1);
15306
15363
  const sizeChanged = oldWidth !== newWidth || oldHeight !== newHeight;
@@ -15545,17 +15602,24 @@ class Renderable extends BaseRenderable {
15545
15602
  y: scissorRect.y,
15546
15603
  width: scissorRect.width,
15547
15604
  height: scissorRect.height,
15548
- screenX: this.x,
15549
- screenY: this.y
15605
+ screenX: this._screenX,
15606
+ screenY: this._screenY
15550
15607
  });
15551
15608
  }
15552
- const visibleChildren = this._getVisibleChildren();
15553
- for (const child of this._childrenInZIndexOrder) {
15554
- if (!visibleChildren.includes(child.num)) {
15555
- child.updateFromLayout();
15556
- continue;
15609
+ if (!this._hasVisibleChildFilter()) {
15610
+ for (const child of this._childrenInZIndexOrder) {
15611
+ child.updateLayout(deltaTime, renderList);
15612
+ }
15613
+ } else {
15614
+ const visibleChildren = this._getVisibleChildren();
15615
+ const visibleChildSet = new Set(visibleChildren);
15616
+ for (const child of this._childrenInZIndexOrder) {
15617
+ if (!visibleChildSet.has(child.num)) {
15618
+ child.updateFromLayout();
15619
+ continue;
15620
+ }
15621
+ child.updateLayout(deltaTime, renderList);
15557
15622
  }
15558
- child.updateLayout(deltaTime, renderList);
15559
15623
  }
15560
15624
  if (shouldPushScissor) {
15561
15625
  renderList.push({ action: "popScissorRect" });
@@ -15576,20 +15640,25 @@ class Renderable extends BaseRenderable {
15576
15640
  if (this.renderAfter) {
15577
15641
  this.renderAfter.call(this, renderBuffer, deltaTime);
15578
15642
  }
15643
+ const screenX = this._screenX;
15644
+ const screenY = this._screenY;
15579
15645
  this.markClean();
15580
- this._ctx.addToHitGrid(this.x, this.y, this.width, this.height, this.num);
15646
+ this._ctx.addToHitGrid(screenX, screenY, this.width, this.height, this.num);
15581
15647
  if (this.buffered && this.frameBuffer) {
15582
- buffer.drawFrameBuffer(this.x, this.y, this.frameBuffer);
15648
+ buffer.drawFrameBuffer(screenX, screenY, this.frameBuffer);
15583
15649
  }
15584
15650
  }
15651
+ _hasVisibleChildFilter() {
15652
+ return this._getVisibleChildren !== Renderable.prototype._getVisibleChildren;
15653
+ }
15585
15654
  _getVisibleChildren() {
15586
15655
  return this._childrenInZIndexOrder.map((child) => child.num);
15587
15656
  }
15588
15657
  onUpdate(deltaTime) {}
15589
15658
  getScissorRect() {
15590
15659
  return {
15591
- x: this.buffered ? 0 : this.x,
15592
- y: this.buffered ? 0 : this.y,
15660
+ x: this.buffered ? 0 : this._screenX,
15661
+ y: this.buffered ? 0 : this._screenY,
15593
15662
  width: this.width,
15594
15663
  height: this.height
15595
15664
  };
@@ -16590,6 +16659,41 @@ function mergeKeyBindings(defaults, custom) {
16590
16659
  function getKeyBindingKey(binding) {
16591
16660
  return `${binding.name}:${binding.ctrl ? 1 : 0}:${binding.shift ? 1 : 0}:${binding.meta ? 1 : 0}:${binding.super ? 1 : 0}`;
16592
16661
  }
16662
+ function getBaseCodeKeyName(baseCode) {
16663
+ if (baseCode === undefined || baseCode < 32 || baseCode === 127) {
16664
+ return;
16665
+ }
16666
+ try {
16667
+ const name = String.fromCodePoint(baseCode);
16668
+ if (name.length === 1 && name >= "A" && name <= "Z") {
16669
+ return name.toLowerCase();
16670
+ }
16671
+ return name;
16672
+ } catch {
16673
+ return;
16674
+ }
16675
+ }
16676
+ function getKeyBindingKeys(binding) {
16677
+ const names = new Set([binding.name]);
16678
+ const baseCodeName = getBaseCodeKeyName(binding.baseCode);
16679
+ if (baseCodeName) {
16680
+ names.add(baseCodeName);
16681
+ }
16682
+ return [...names].map((name) => getKeyBindingKey({ ...binding, name }));
16683
+ }
16684
+ function getKeyBindingAction(map, binding) {
16685
+ for (const key of getKeyBindingKeys(binding)) {
16686
+ const action = map.get(key);
16687
+ if (action !== undefined) {
16688
+ return action;
16689
+ }
16690
+ }
16691
+ return;
16692
+ }
16693
+ function matchesKeyBinding(binding, match) {
16694
+ const matchKey = getKeyBindingKey(match);
16695
+ return getKeyBindingKeys(binding).includes(matchKey);
16696
+ }
16593
16697
  function buildKeyBindingsMap(bindings, aliasMap) {
16594
16698
  const map = new Map;
16595
16699
  const aliases = aliasMap || {};
@@ -16973,15 +17077,7 @@ class TerminalConsole extends EventEmitter8 {
16973
17077
  this.blur();
16974
17078
  return;
16975
17079
  }
16976
- const bindingKey = getKeyBindingKey({
16977
- name: event.name,
16978
- ctrl: event.ctrl,
16979
- shift: event.shift,
16980
- meta: event.meta,
16981
- super: event.super,
16982
- action: "scroll-up"
16983
- });
16984
- const action = this._keyBindingsMap.get(bindingKey);
17080
+ const action = getKeyBindingAction(this._keyBindingsMap, event);
16985
17081
  if (action) {
16986
17082
  const handler = this._actionHandlers.get(action);
16987
17083
  if (handler) {
@@ -18351,8 +18447,10 @@ class EditBufferRenderable extends Renderable {
18351
18447
  return;
18352
18448
  if (this.isDestroyed)
18353
18449
  return;
18450
+ const screenX = this._screenX;
18451
+ const screenY = this._screenY;
18354
18452
  this.markClean();
18355
- this._ctx.addToHitGrid(this.x, this.y, this.width, this.height, this.num);
18453
+ this._ctx.addToHitGrid(screenX, screenY, this.width, this.height, this.num);
18356
18454
  this.renderSelf(buffer);
18357
18455
  this.renderCursor(buffer);
18358
18456
  }
@@ -18363,8 +18461,10 @@ class EditBufferRenderable extends Renderable {
18363
18461
  if (!this._showCursor || !this._focused)
18364
18462
  return;
18365
18463
  const visualCursor = this.editorView.getVisualCursor();
18366
- const cursorX = this.x + visualCursor.visualCol + 1;
18367
- const cursorY = this.y + visualCursor.visualRow + 1;
18464
+ const screenX = this._screenX;
18465
+ const screenY = this._screenY;
18466
+ const cursorX = screenX + visualCursor.visualCol + 1;
18467
+ const cursorY = screenY + visualCursor.visualRow + 1;
18368
18468
  this._ctx.setCursorPosition(cursorX, cursorY, true);
18369
18469
  this._ctx.setCursorStyle({ ...this._cursorStyle, color: this._cursorColor });
18370
18470
  }
@@ -18564,8 +18664,8 @@ function getObjectsInViewport(viewport, objects, direction = "column", padding =
18564
18664
  while (lo <= hi) {
18565
18665
  const mid = lo + hi >> 1;
18566
18666
  const c = children[mid];
18567
- const start = isRow ? c.x : c.y;
18568
- const end = isRow ? c.x + c.width : c.y + c.height;
18667
+ const start = isRow ? c.screenX : c.screenY;
18668
+ const end = isRow ? c.screenX + c.width : c.screenY + c.height;
18569
18669
  if (end < vpStart) {
18570
18670
  lo = mid + 1;
18571
18671
  } else if (start > vpEnd) {
@@ -18584,7 +18684,7 @@ function getObjectsInViewport(viewport, objects, direction = "column", padding =
18584
18684
  let gapCount = 0;
18585
18685
  while (left - 1 >= 0) {
18586
18686
  const prev = children[left - 1];
18587
- const prevEnd = isRow ? prev.x + prev.width : prev.y + prev.height;
18687
+ const prevEnd = isRow ? prev.screenX + prev.width : prev.screenY + prev.height;
18588
18688
  if (prevEnd <= vpStart) {
18589
18689
  gapCount++;
18590
18690
  if (gapCount >= maxLookBehind) {
@@ -18598,30 +18698,30 @@ function getObjectsInViewport(viewport, objects, direction = "column", padding =
18598
18698
  let right = candidate + 1;
18599
18699
  while (right < totalChildren) {
18600
18700
  const next = children[right];
18601
- if ((isRow ? next.x : next.y) >= vpEnd)
18701
+ if ((isRow ? next.screenX : next.screenY) >= vpEnd)
18602
18702
  break;
18603
18703
  right++;
18604
18704
  }
18605
18705
  for (let i = left;i < right; i++) {
18606
18706
  const child = children[i];
18607
- const start = isRow ? child.x : child.y;
18608
- const end = isRow ? child.x + child.width : child.y + child.height;
18707
+ const start = isRow ? child.screenX : child.screenY;
18708
+ const end = isRow ? child.screenX + child.width : child.screenY + child.height;
18609
18709
  if (end <= vpStart)
18610
18710
  continue;
18611
18711
  if (start >= vpEnd)
18612
18712
  break;
18613
18713
  if (isRow) {
18614
- const childBottom = child.y + child.height;
18714
+ const childBottom = child.screenY + child.height;
18615
18715
  if (childBottom < viewportTop)
18616
18716
  continue;
18617
- const childTop = child.y;
18717
+ const childTop = child.screenY;
18618
18718
  if (childTop > viewportBottom)
18619
18719
  continue;
18620
18720
  } else {
18621
- const childRight = child.x + child.width;
18721
+ const childRight = child.screenX + child.width;
18622
18722
  if (childRight < viewportLeft)
18623
18723
  continue;
18624
- const childLeft = child.x;
18724
+ const childLeft = child.screenX;
18625
18725
  if (childLeft > viewportRight)
18626
18726
  continue;
18627
18727
  }
@@ -18852,7 +18952,7 @@ var rendererTracker = singleton("RendererTracker", () => {
18852
18952
  });
18853
18953
  async function createCliRenderer(config = {}) {
18854
18954
  if (process.argv.includes("--delay-start")) {
18855
- await new Promise((resolve3) => setTimeout(resolve3, 5000));
18955
+ await new Promise((resolve4) => setTimeout(resolve4, 5000));
18856
18956
  }
18857
18957
  const stdin = config.stdin || process.stdin;
18858
18958
  const stdout = config.stdout || process.stdout;
@@ -19136,7 +19236,7 @@ Captured output:
19136
19236
  const useKittyForParsing = kittyConfig !== null;
19137
19237
  this._keyHandler = new InternalKeyHandler;
19138
19238
  this._keyHandler.on("keypress", (event) => {
19139
- if (this.exitOnCtrlC && event.name === "c" && event.ctrl) {
19239
+ if (this.exitOnCtrlC && matchesKeyBinding(event, { name: "c", ctrl: true })) {
19140
19240
  process.nextTick(() => {
19141
19241
  this.destroy();
19142
19242
  });
@@ -19350,8 +19450,8 @@ Captured output:
19350
19450
  if (!this.isIdleNow())
19351
19451
  return;
19352
19452
  const resolvers = this.idleResolvers.splice(0);
19353
- for (const resolve3 of resolvers) {
19354
- resolve3();
19453
+ for (const resolve4 of resolvers) {
19454
+ resolve4();
19355
19455
  }
19356
19456
  }
19357
19457
  idle() {
@@ -19359,8 +19459,8 @@ Captured output:
19359
19459
  return Promise.resolve();
19360
19460
  if (this.isIdleNow())
19361
19461
  return Promise.resolve();
19362
- return new Promise((resolve3) => {
19363
- this.idleResolvers.push(resolve3);
19462
+ return new Promise((resolve4) => {
19463
+ this.idleResolvers.push(resolve4);
19364
19464
  });
19365
19465
  }
19366
19466
  get resolution() {
@@ -20630,7 +20730,7 @@ Captured output:
20630
20730
  }
20631
20731
  }
20632
20732
 
20633
- export { __toESM, __commonJS, __export, __require, Edge, Gutter, MeasureMode, exports_src, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, RGBA, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, ATTRIBUTE_BASE_BITS, ATTRIBUTE_BASE_MASK, getBaseAttributes, DebugOverlayCorner, TargetChannel, createTextAttributes, attributesWithLink, getLinkId, visualizeRenderableTree, isStyledText, StyledText, stringToStyledText, black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bold, italic, underline, strikethrough, dim, reverse, blink, fg, bg, link, t, hastToStyledText, SystemClock, nonAlphanumericKeys, parseKeypress, LinearScrollAccel, MacOSScrollAccel, parseAlign, parseAlignItems, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, StdinParser, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extensionToFiletype, basenameToFiletype, extToFiletype, pathToFiletype, infoStringToFiletype, main, getTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, decodePasteBytes, stripAnsiSequences, detectLinks, TextBuffer, SpanInfoStruct, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, isValidPercentage, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, EditBuffer, EditorView, ANSI, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingKey, buildKeyBindingsMap, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, EditBufferRenderableEvents, isEditBufferRenderable, EditBufferRenderable, buildKittyKeyboardFlags, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
20733
+ export { __toESM, __commonJS, __export, __require, Edge, Gutter, MeasureMode, exports_src, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, RGBA, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, ATTRIBUTE_BASE_BITS, ATTRIBUTE_BASE_MASK, getBaseAttributes, DebugOverlayCorner, TargetChannel, createTextAttributes, attributesWithLink, getLinkId, visualizeRenderableTree, isStyledText, StyledText, stringToStyledText, black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bold, italic, underline, strikethrough, dim, reverse, blink, fg, bg, link, t, hastToStyledText, SystemClock, nonAlphanumericKeys, parseKeypress, LinearScrollAccel, MacOSScrollAccel, parseAlign, parseAlignItems, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, StdinParser, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extensionToFiletype, basenameToFiletype, extToFiletype, pathToFiletype, infoStringToFiletype, main, getTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, decodePasteBytes, stripAnsiSequences, detectLinks, TextBuffer, SpanInfoStruct, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, isValidPercentage, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, EditBuffer, EditorView, ANSI, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingAction, buildKeyBindingsMap, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, EditBufferRenderableEvents, isEditBufferRenderable, EditBufferRenderable, buildKittyKeyboardFlags, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
20634
20734
 
20635
- //# debugId=B248918F8F174E3E64756E2164756E21
20636
- //# sourceMappingURL=index-g2c8aqza.js.map
20735
+ //# debugId=F735FC939C22368E64756E2164756E21
20736
+ //# sourceMappingURL=index-c4vtensm.js.map