@opentui/core 0.1.58 → 0.1.60

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.
package/index.js CHANGED
@@ -61,6 +61,7 @@ import {
61
61
  brightRed,
62
62
  brightWhite,
63
63
  brightYellow,
64
+ buildKittyKeyboardFlags,
64
65
  capture,
65
66
  clearEnvCache,
66
67
  convertGlobalToLocalSelection,
@@ -137,7 +138,7 @@ import {
137
138
  white,
138
139
  wrapWithDelegates,
139
140
  yellow
140
- } from "./index-crebvcxc.js";
141
+ } from "./index-916mvx7m.js";
141
142
  // src/text-buffer-view.ts
142
143
  class TextBufferView {
143
144
  lib;
@@ -308,29 +309,33 @@ class EditBuffer extends EventEmitter {
308
309
  this.guard();
309
310
  return this.bufferPtr;
310
311
  }
311
- setText(text, opts) {
312
+ setText(text) {
312
313
  this.guard();
313
- const history = opts?.history ?? true;
314
314
  const textBytes = this.lib.encoder.encode(text);
315
- if (history) {
316
- this._textBytes.push(textBytes);
317
- const memId = this.lib.textBufferRegisterMemBuffer(this.textBufferPtr, textBytes, false);
318
- this.lib.editBufferSetTextFromMem(this.bufferPtr, memId, true);
315
+ if (this._singleTextMemId !== null) {
316
+ this.lib.textBufferReplaceMemBuffer(this.textBufferPtr, this._singleTextMemId, textBytes, false);
319
317
  } else {
320
- if (this._singleTextMemId !== null) {
321
- this.lib.textBufferReplaceMemBuffer(this.textBufferPtr, this._singleTextMemId, textBytes, false);
322
- } else {
323
- this._singleTextMemId = this.lib.textBufferRegisterMemBuffer(this.textBufferPtr, textBytes, false);
324
- }
325
- this._singleTextBytes = textBytes;
326
- this.lib.editBufferSetTextFromMem(this.bufferPtr, this._singleTextMemId, false);
318
+ this._singleTextMemId = this.lib.textBufferRegisterMemBuffer(this.textBufferPtr, textBytes, false);
327
319
  }
320
+ this._singleTextBytes = textBytes;
321
+ this.lib.editBufferSetTextFromMem(this.bufferPtr, this._singleTextMemId);
328
322
  }
329
- setTextOwned(text, opts) {
323
+ setTextOwned(text) {
330
324
  this.guard();
331
- const history = opts?.history ?? true;
332
325
  const textBytes = this.lib.encoder.encode(text);
333
- this.lib.editBufferSetText(this.bufferPtr, textBytes, history);
326
+ this.lib.editBufferSetText(this.bufferPtr, textBytes);
327
+ }
328
+ replaceText(text) {
329
+ this.guard();
330
+ const textBytes = this.lib.encoder.encode(text);
331
+ this._textBytes.push(textBytes);
332
+ const memId = this.lib.textBufferRegisterMemBuffer(this.textBufferPtr, textBytes, false);
333
+ this.lib.editBufferReplaceTextFromMem(this.bufferPtr, memId);
334
+ }
335
+ replaceTextOwned(text) {
336
+ this.guard();
337
+ const textBytes = this.lib.encoder.encode(text);
338
+ this.lib.editBufferReplaceText(this.bufferPtr, textBytes);
334
339
  }
335
340
  getLineCount() {
336
341
  this.guard();
@@ -5720,9 +5725,15 @@ class InputRenderable extends Renderable {
5720
5725
  return true;
5721
5726
  }
5722
5727
  }
5723
- if (keySequence && keySequence.length === 1 && keySequence.charCodeAt(0) >= 32 && keySequence.charCodeAt(0) <= 126 && !keyCtrl && !keyMeta && !keySuper && !keyHyper) {
5724
- this.insertText(keySequence);
5725
- return true;
5728
+ if (!keyCtrl && !keyMeta && !keySuper && !keyHyper) {
5729
+ if (keyName === "space") {
5730
+ this.insertText(" ");
5731
+ return true;
5732
+ }
5733
+ if (keySequence && keySequence.length === 1 && keySequence.charCodeAt(0) >= 32 && keySequence.charCodeAt(0) <= 126) {
5734
+ this.insertText(keySequence);
5735
+ return true;
5736
+ }
5726
5737
  }
5727
5738
  return false;
5728
5739
  }
@@ -8099,8 +8110,13 @@ class EditBufferRenderable extends Renderable {
8099
8110
  getLineHighlights(lineIdx) {
8100
8111
  return this.editBuffer.getLineHighlights(lineIdx);
8101
8112
  }
8102
- setText(text, opts) {
8103
- this.editBuffer.setText(text, opts);
8113
+ setText(text) {
8114
+ this.editBuffer.setText(text);
8115
+ this.yogaNode.markDirty();
8116
+ this.requestRender();
8117
+ }
8118
+ replaceText(text) {
8119
+ this.editBuffer.replaceText(text);
8104
8120
  this.yogaNode.markDirty();
8105
8121
  this.requestRender();
8106
8122
  }
@@ -8195,12 +8211,13 @@ var defaultTextareaKeybindings = [
8195
8211
  { name: "e", ctrl: true, action: "line-end" },
8196
8212
  { name: "f", ctrl: true, action: "move-right" },
8197
8213
  { name: "b", ctrl: true, action: "move-left" },
8198
- { name: "d", ctrl: true, action: "delete-word-forward" },
8214
+ { name: "w", ctrl: true, shift: true, action: "delete-word-forward" },
8199
8215
  { name: "w", ctrl: true, action: "delete-word-backward" },
8200
8216
  { name: "k", ctrl: true, action: "delete-to-line-end" },
8201
8217
  { name: "u", ctrl: true, action: "delete-to-line-start" },
8202
8218
  { name: "backspace", action: "backspace" },
8203
8219
  { name: "backspace", shift: true, action: "backspace" },
8220
+ { name: "d", ctrl: true, action: "delete" },
8204
8221
  { name: "delete", action: "delete" },
8205
8222
  { name: "delete", shift: true, action: "delete" },
8206
8223
  { name: "return", action: "newline" },
@@ -8341,16 +8358,22 @@ class TextareaRenderable extends EditBufferRenderable {
8341
8358
  return handler();
8342
8359
  }
8343
8360
  }
8344
- if (keySequence && !keyCtrl && !keyMeta && !keySuper && !keyHyper) {
8345
- const firstCharCode = keySequence.charCodeAt(0);
8346
- if (firstCharCode < 32) {
8347
- return false;
8361
+ if (!keyCtrl && !keyMeta && !keySuper && !keyHyper) {
8362
+ if (keyName === "space") {
8363
+ this.insertText(" ");
8364
+ return true;
8348
8365
  }
8349
- if (firstCharCode === 127) {
8350
- return false;
8366
+ if (keySequence) {
8367
+ const firstCharCode = keySequence.charCodeAt(0);
8368
+ if (firstCharCode < 32) {
8369
+ return false;
8370
+ }
8371
+ if (firstCharCode === 127) {
8372
+ return false;
8373
+ }
8374
+ this.insertText(keySequence);
8375
+ return true;
8351
8376
  }
8352
- this.insertText(keySequence);
8353
- return true;
8354
8377
  }
8355
8378
  return false;
8356
8379
  }
@@ -8733,6 +8756,7 @@ export {
8733
8756
  convertGlobalToLocalSelection,
8734
8757
  clearEnvCache,
8735
8758
  capture,
8759
+ buildKittyKeyboardFlags,
8736
8760
  brightYellow,
8737
8761
  brightWhite,
8738
8762
  brightRed,
@@ -8841,5 +8865,5 @@ export {
8841
8865
  ASCIIFont
8842
8866
  };
8843
8867
 
8844
- //# debugId=AA9B550CE879718B64756E2164756E21
8868
+ //# debugId=8034F385F70736E264756E2164756E21
8845
8869
  //# sourceMappingURL=index.js.map