@opentui/core 0.1.57 → 0.1.59

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
@@ -4573,6 +4573,7 @@ class DiffRenderable extends Renderable {
4573
4573
  _view;
4574
4574
  _parsedDiff = null;
4575
4575
  _parseError = null;
4576
+ _fg;
4576
4577
  _filetype;
4577
4578
  _syntaxStyle;
4578
4579
  _wrapMode;
@@ -4610,6 +4611,7 @@ class DiffRenderable extends Renderable {
4610
4611
  });
4611
4612
  this._diff = options.diff ?? "";
4612
4613
  this._view = options.view ?? "unified";
4614
+ this._fg = options.fg ? parseColor(options.fg) : undefined;
4613
4615
  this._filetype = options.filetype;
4614
4616
  this._syntaxStyle = options.syntaxStyle;
4615
4617
  this._wrapMode = options.wrapMode;
@@ -4770,6 +4772,7 @@ class DiffRenderable extends Renderable {
4770
4772
  syntaxStyle: this._syntaxStyle ?? SyntaxStyle.create(),
4771
4773
  width: "100%",
4772
4774
  height: "100%",
4775
+ ...this._fg !== undefined && { fg: this._fg },
4773
4776
  ...drawUnstyledText !== undefined && { drawUnstyledText },
4774
4777
  ...this._selectionBg !== undefined && { selectionBg: this._selectionBg },
4775
4778
  ...this._selectionFg !== undefined && { selectionFg: this._selectionFg },
@@ -4801,6 +4804,9 @@ class DiffRenderable extends Renderable {
4801
4804
  if (this._selectionFg !== undefined) {
4802
4805
  existingRenderable.selectionFg = this._selectionFg;
4803
4806
  }
4807
+ if (this._fg !== undefined) {
4808
+ existingRenderable.fg = this._fg;
4809
+ }
4804
4810
  return existingRenderable;
4805
4811
  }
4806
4812
  }
@@ -5412,6 +5418,21 @@ class DiffRenderable extends Renderable {
5412
5418
  this.rebuildView();
5413
5419
  }
5414
5420
  }
5421
+ get fg() {
5422
+ return this._fg;
5423
+ }
5424
+ set fg(value) {
5425
+ const parsed = value ? parseColor(value) : undefined;
5426
+ if (this._fg !== parsed) {
5427
+ this._fg = parsed;
5428
+ if (this.leftCodeRenderable) {
5429
+ this.leftCodeRenderable.fg = parsed;
5430
+ }
5431
+ if (this.rightCodeRenderable) {
5432
+ this.rightCodeRenderable.fg = parsed;
5433
+ }
5434
+ }
5435
+ }
5415
5436
  }
5416
5437
  // src/lib/keymapping.ts
5417
5438
  var defaultKeyAliases = {
@@ -5699,9 +5720,15 @@ class InputRenderable extends Renderable {
5699
5720
  return true;
5700
5721
  }
5701
5722
  }
5702
- if (keySequence && keySequence.length === 1 && keySequence.charCodeAt(0) >= 32 && keySequence.charCodeAt(0) <= 126 && !keyCtrl && !keyMeta && !keySuper && !keyHyper) {
5703
- this.insertText(keySequence);
5704
- return true;
5723
+ if (!keyCtrl && !keyMeta && !keySuper && !keyHyper) {
5724
+ if (keyName === "space") {
5725
+ this.insertText(" ");
5726
+ return true;
5727
+ }
5728
+ if (keySequence && keySequence.length === 1 && keySequence.charCodeAt(0) >= 32 && keySequence.charCodeAt(0) <= 126) {
5729
+ this.insertText(keySequence);
5730
+ return true;
5731
+ }
5705
5732
  }
5706
5733
  return false;
5707
5734
  }
@@ -6391,7 +6418,7 @@ class ContentRenderable extends BoxRenderable {
6391
6418
  }
6392
6419
  _getVisibleChildren() {
6393
6420
  if (this._viewportCulling) {
6394
- return getObjectsInViewport(this.viewport, this.getChildrenSortedByPrimaryAxis(), this.primaryAxis).map((child) => child.num);
6421
+ return getObjectsInViewport(this.viewport, this.getChildrenSortedByPrimaryAxis(), this.primaryAxis, 0).map((child) => child.num);
6395
6422
  }
6396
6423
  return this.getChildrenSortedByPrimaryAxis().map((child) => child.num);
6397
6424
  }
@@ -8320,16 +8347,22 @@ class TextareaRenderable extends EditBufferRenderable {
8320
8347
  return handler();
8321
8348
  }
8322
8349
  }
8323
- if (keySequence && !keyCtrl && !keyMeta && !keySuper && !keyHyper) {
8324
- const firstCharCode = keySequence.charCodeAt(0);
8325
- if (firstCharCode < 32) {
8326
- return false;
8350
+ if (!keyCtrl && !keyMeta && !keySuper && !keyHyper) {
8351
+ if (keyName === "space") {
8352
+ this.insertText(" ");
8353
+ return true;
8327
8354
  }
8328
- if (firstCharCode === 127) {
8329
- return false;
8355
+ if (keySequence) {
8356
+ const firstCharCode = keySequence.charCodeAt(0);
8357
+ if (firstCharCode < 32) {
8358
+ return false;
8359
+ }
8360
+ if (firstCharCode === 127) {
8361
+ return false;
8362
+ }
8363
+ this.insertText(keySequence);
8364
+ return true;
8330
8365
  }
8331
- this.insertText(keySequence);
8332
- return true;
8333
8366
  }
8334
8367
  return false;
8335
8368
  }
@@ -8430,7 +8463,13 @@ class TextareaRenderable extends EditBufferRenderable {
8430
8463
  const select = options?.select ?? false;
8431
8464
  this.updateSelectionForMovement(select, true);
8432
8465
  const cursor = this.editorView.getCursor();
8433
- this.editBuffer.setCursor(cursor.row, 0);
8466
+ if (cursor.col === 0 && cursor.row > 0) {
8467
+ this.editBuffer.setCursor(cursor.row - 1, 0);
8468
+ const prevLineEol = this.editBuffer.getEOL();
8469
+ this.editBuffer.setCursor(prevLineEol.row, prevLineEol.col);
8470
+ } else {
8471
+ this.editBuffer.setCursor(cursor.row, 0);
8472
+ }
8434
8473
  this.updateSelectionForMovement(select, false);
8435
8474
  this.requestRender();
8436
8475
  return true;
@@ -8438,8 +8477,14 @@ class TextareaRenderable extends EditBufferRenderable {
8438
8477
  gotoLineEnd(options) {
8439
8478
  const select = options?.select ?? false;
8440
8479
  this.updateSelectionForMovement(select, true);
8480
+ const cursor = this.editorView.getCursor();
8441
8481
  const eol = this.editBuffer.getEOL();
8442
- this.editBuffer.setCursor(eol.row, eol.col);
8482
+ const lineCount = this.editBuffer.getLineCount();
8483
+ if (cursor.col === eol.col && cursor.row < lineCount - 1) {
8484
+ this.editBuffer.setCursor(cursor.row + 1, 0);
8485
+ } else {
8486
+ this.editBuffer.setCursor(eol.row, eol.col);
8487
+ }
8443
8488
  this.updateSelectionForMovement(select, false);
8444
8489
  this.requestRender();
8445
8490
  return true;
@@ -8808,5 +8853,5 @@ export {
8808
8853
  ASCIIFont
8809
8854
  };
8810
8855
 
8811
- //# debugId=0B9337575CE949C264756E2164756E21
8856
+ //# debugId=69099B83255E61E264756E2164756E21
8812
8857
  //# sourceMappingURL=index.js.map