@opentui/core 0.1.59 → 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);
322
+ }
323
+ setTextOwned(text) {
324
+ this.guard();
325
+ const textBytes = this.lib.encoder.encode(text);
326
+ this.lib.editBufferSetText(this.bufferPtr, textBytes);
328
327
  }
329
- setTextOwned(text, opts) {
328
+ replaceText(text) {
330
329
  this.guard();
331
- const history = opts?.history ?? true;
332
330
  const textBytes = this.lib.encoder.encode(text);
333
- this.lib.editBufferSetText(this.bufferPtr, textBytes, history);
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();
@@ -8105,8 +8110,13 @@ class EditBufferRenderable extends Renderable {
8105
8110
  getLineHighlights(lineIdx) {
8106
8111
  return this.editBuffer.getLineHighlights(lineIdx);
8107
8112
  }
8108
- setText(text, opts) {
8109
- 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);
8110
8120
  this.yogaNode.markDirty();
8111
8121
  this.requestRender();
8112
8122
  }
@@ -8201,12 +8211,13 @@ var defaultTextareaKeybindings = [
8201
8211
  { name: "e", ctrl: true, action: "line-end" },
8202
8212
  { name: "f", ctrl: true, action: "move-right" },
8203
8213
  { name: "b", ctrl: true, action: "move-left" },
8204
- { name: "d", ctrl: true, action: "delete-word-forward" },
8214
+ { name: "w", ctrl: true, shift: true, action: "delete-word-forward" },
8205
8215
  { name: "w", ctrl: true, action: "delete-word-backward" },
8206
8216
  { name: "k", ctrl: true, action: "delete-to-line-end" },
8207
8217
  { name: "u", ctrl: true, action: "delete-to-line-start" },
8208
8218
  { name: "backspace", action: "backspace" },
8209
8219
  { name: "backspace", shift: true, action: "backspace" },
8220
+ { name: "d", ctrl: true, action: "delete" },
8210
8221
  { name: "delete", action: "delete" },
8211
8222
  { name: "delete", shift: true, action: "delete" },
8212
8223
  { name: "return", action: "newline" },
@@ -8745,6 +8756,7 @@ export {
8745
8756
  convertGlobalToLocalSelection,
8746
8757
  clearEnvCache,
8747
8758
  capture,
8759
+ buildKittyKeyboardFlags,
8748
8760
  brightYellow,
8749
8761
  brightWhite,
8750
8762
  brightRed,
@@ -8853,5 +8865,5 @@ export {
8853
8865
  ASCIIFont
8854
8866
  };
8855
8867
 
8856
- //# debugId=69099B83255E61E264756E2164756E21
8868
+ //# debugId=8034F385F70736E264756E2164756E21
8857
8869
  //# sourceMappingURL=index.js.map