@oh-my-pi/pi-tui 13.14.0 → 13.14.2

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/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [13.14.1] - 2026-03-21
6
+ ### Added
7
+
8
+ - Added Ctrl+_ as an additional default shortcut for undo
9
+
10
+ ### Fixed
11
+
12
+ - Ensured undo functionality respects user-configured keybindings
13
+
5
14
  ## [13.12.0] - 2026-03-14
6
15
 
7
16
  ### Added
@@ -643,4 +652,4 @@ Initial release under @oh-my-pi scope. See previous releases at [badlogic/pi-mon
643
652
 
644
653
  ### Fixed
645
654
 
646
- - **Readline-style Ctrl+W**: Now skips trailing whitespace before deleting the preceding word, matching standard readline behavior. ([#306](https://github.com/badlogic/pi-mono/pull/306) by [@kim0](https://github.com/kim0))
655
+ - **Readline-style Ctrl+W**: Now skips trailing whitespace before deleting the preceding word, matching standard readline behavior. ([#306](https://github.com/badlogic/pi-mono/pull/306) by [@kim0](https://github.com/kim0))
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-tui",
4
- "version": "13.14.0",
4
+ "version": "13.14.2",
5
5
  "description": "Terminal User Interface library with differential rendering for efficient text-based applications",
6
6
  "homepage": "https://github.com/can1357/oh-my-pi",
7
7
  "author": "Can Boluk",
@@ -33,8 +33,8 @@
33
33
  "test": "bun test test/*.test.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@oh-my-pi/pi-natives": "13.14.0",
37
- "@oh-my-pi/pi-utils": "13.14.0",
36
+ "@oh-my-pi/pi-natives": "13.14.2",
37
+ "@oh-my-pi/pi-utils": "13.14.2",
38
38
  "marked": "^17.0"
39
39
  },
40
40
  "devDependencies": {
@@ -732,8 +732,8 @@ export class Editor implements Component, Focusable {
732
732
  return;
733
733
  }
734
734
 
735
- // Ctrl+- / Ctrl+_ - Undo last edit
736
- if (matchesKey(data, "ctrl+-") || matchesKey(data, "ctrl+_")) {
735
+ // Undo
736
+ if (kb.matches(data, "undo")) {
737
737
  this.#applyUndo();
738
738
  return;
739
739
  }
@@ -86,7 +86,7 @@ export const DEFAULT_EDITOR_KEYBINDINGS: Required<EditorKeybindingsConfig> = {
86
86
  // Clipboard
87
87
  copy: "ctrl+c",
88
88
  // Kill ring / undo
89
- undo: "ctrl+-",
89
+ undo: ["ctrl+-", "ctrl+_"],
90
90
  yank: "ctrl+y",
91
91
  yankPop: "alt+y",
92
92
  };
package/src/tui.ts CHANGED
@@ -890,17 +890,6 @@ export class TUI extends Container {
890
890
  return result;
891
891
  }
892
892
 
893
- #applyLineResets(lines: string[]): string[] {
894
- const reset = SEGMENT_RESET;
895
- for (let i = 0; i < lines.length; i++) {
896
- const line = lines[i];
897
- if (!TERMINAL.isImageLine(line)) {
898
- lines[i] = line + reset;
899
- }
900
- }
901
- return lines;
902
- }
903
-
904
893
  /** Splice overlay content into a base line at a specific column. Single-pass optimized. */
905
894
  #compositeLineAt(
906
895
  baseLine: string,
@@ -1001,11 +990,9 @@ export class TUI extends Container {
1001
990
  newLines = this.#compositeOverlays(newLines, width, height);
1002
991
  }
1003
992
 
1004
- // Extract cursor position before applying line resets (marker must be found first)
993
+ // Extract cursor position (marker must be found before diff comparison)
1005
994
  const cursorPos = this.#extractCursorPosition(newLines, height);
1006
995
 
1007
- newLines = this.#applyLineResets(newLines);
1008
-
1009
996
  // Width changed - need full re-render (line wrapping changes)
1010
997
  const widthChanged = this.#previousWidth !== 0 && this.#previousWidth !== width;
1011
998
 
@@ -1014,9 +1001,11 @@ export class TUI extends Container {
1014
1001
  this.#fullRedrawCount += 1;
1015
1002
  let buffer = "\x1b[?2026h"; // Begin synchronized output
1016
1003
  if (clear) buffer += "\x1b[3J\x1b[2J\x1b[H"; // Clear scrollback, screen, and home
1004
+ const reset = SEGMENT_RESET;
1017
1005
  for (let i = 0; i < newLines.length; i++) {
1018
1006
  if (i > 0) buffer += "\r\n";
1019
- buffer += newLines[i];
1007
+ const line = newLines[i];
1008
+ buffer += TERMINAL.isImageLine(line) ? line : line + reset;
1020
1009
  }
1021
1010
  buffer += "\x1b[?2026l"; // End synchronized output
1022
1011
  this.terminal.write(buffer);
@@ -1211,7 +1200,7 @@ export class TUI extends Container {
1211
1200
  ].join("\n");
1212
1201
  throw new Error(errorMsg);
1213
1202
  }
1214
- buffer += line;
1203
+ buffer += isImage ? line : line + SEGMENT_RESET;
1215
1204
  }
1216
1205
 
1217
1206
  // Track where cursor ended up after rendering