@oh-my-pi/pi-tui 12.3.0 → 12.5.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-tui",
3
- "version": "12.3.0",
3
+ "version": "12.5.0",
4
4
  "description": "Terminal User Interface library with differential rendering for efficient text-based applications",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -52,11 +52,11 @@
52
52
  "bun": ">=1.3.7"
53
53
  },
54
54
  "dependencies": {
55
- "@oh-my-pi/pi-natives": "12.3.0",
56
- "@oh-my-pi/pi-utils": "12.3.0",
55
+ "@oh-my-pi/pi-natives": "12.5.0",
56
+ "@oh-my-pi/pi-utils": "12.5.0",
57
57
  "@types/mime-types": "^3.0.1",
58
58
  "chalk": "^5.6.2",
59
- "marked": "^17.0.1",
59
+ "marked": "^17.0.2",
60
60
  "mime-types": "^3.0.2"
61
61
  },
62
62
  "devDependencies": {
@@ -297,6 +297,11 @@ export class Editor implements Component, Focusable {
297
297
  #theme: EditorTheme;
298
298
  #useTerminalCursor = false;
299
299
 
300
+ /** When set, replaces the normal cursor glyph at end-of-text with this ANSI-styled string. */
301
+ cursorOverride: string | undefined;
302
+ /** Display width of the cursorOverride glyph (needed because override may contain ANSI escapes). */
303
+ cursorOverrideWidth: number | undefined;
304
+
300
305
  // Store last layout width for cursor navigation
301
306
  #lastLayoutWidth: number = 80;
302
307
  #paddingXOverride: number | undefined;
@@ -378,6 +383,10 @@ export class Editor implements Component, Focusable {
378
383
  this.#useTerminalCursor = useTerminalCursor;
379
384
  }
380
385
 
386
+ getUseTerminalCursor(): boolean {
387
+ return this.#useTerminalCursor;
388
+ }
389
+
381
390
  setMaxHeight(maxHeight: number | undefined): void {
382
391
  this.#maxHeight = maxHeight;
383
392
  this.#scrollOffset = 0;
@@ -594,6 +603,18 @@ export class Editor implements Component, Focusable {
594
603
  const cursor = `\x1b[7m${firstGrapheme}\x1b[0m`;
595
604
  displayText = before + marker + cursor + restAfter;
596
605
  // displayWidth stays the same - we're replacing, not adding
606
+ } else if (this.cursorOverride) {
607
+ // Cursor override replaces the normal end-of-text cursor glyph
608
+ const overrideWidth = this.cursorOverrideWidth ?? 1;
609
+ if (inlineHint) {
610
+ const availWidth = Math.max(0, lineContentWidth - displayWidth - overrideWidth);
611
+ const hintText = hintStyle(truncateToWidth(inlineHint, availWidth));
612
+ displayText = before + marker + this.cursorOverride + hintText;
613
+ displayWidth += overrideWidth + Math.min(visibleWidth(inlineHint), availWidth);
614
+ } else {
615
+ displayText = before + marker + this.cursorOverride;
616
+ displayWidth += overrideWidth;
617
+ }
597
618
  } else {
598
619
  // Cursor is at the end - add thin cursor glyph
599
620
  const cursorChar = this.#theme.symbols.inputCursor;