@oh-my-pi/pi-tui 13.17.1 → 13.17.6

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/tui.ts +6 -2
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.17.1",
4
+ "version": "13.17.6",
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.17.1",
37
- "@oh-my-pi/pi-utils": "13.17.1",
36
+ "@oh-my-pi/pi-natives": "13.17.6",
37
+ "@oh-my-pi/pi-utils": "13.17.6",
38
38
  "marked": "^17.0"
39
39
  },
40
40
  "devDependencies": {
package/src/tui.ts CHANGED
@@ -112,6 +112,9 @@ function isTermuxSession(): boolean {
112
112
  return Boolean(process.env.TERMUX_VERSION);
113
113
  }
114
114
 
115
+ /** Detect terminal multiplexers where scrollback clearing and height-change redraws are hostile. */
116
+ const isMultiplexer = Boolean(Bun.env.TMUX || Bun.env.STY || Bun.env.ZELLIJ);
117
+
115
118
  /**
116
119
  * Options for overlay positioning and sizing.
117
120
  * Values can be absolute numbers or percentage strings (e.g., "50%").
@@ -1007,7 +1010,8 @@ export class TUI extends Container {
1007
1010
  const fullRender = (clear: boolean): void => {
1008
1011
  this.#fullRedrawCount += 1;
1009
1012
  let buffer = "\x1b[?2026h"; // Begin synchronized output
1010
- if (clear) buffer += "\x1b[2J\x1b[H\x1b[3J"; // Clear screen, home, then clear scrollback
1013
+ // Skip clearing scrollback (3J) in multiplexers users actively navigate scrollback history
1014
+ if (clear) buffer += isMultiplexer ? "\x1b[2J\x1b[H" : "\x1b[2J\x1b[H\x1b[3J";
1011
1015
  const reset = SEGMENT_RESET;
1012
1016
  for (let i = 0; i < newLines.length; i++) {
1013
1017
  if (i > 0) buffer += "\r\n";
@@ -1056,7 +1060,7 @@ export class TUI extends Container {
1056
1060
  // Height changes normally need a full re-render to keep the visible viewport aligned,
1057
1061
  // but Termux changes height when the software keyboard shows or hides.
1058
1062
  // In that environment, a full redraw causes the entire history to replay on every toggle.
1059
- if (heightChanged && !isTermuxSession()) {
1063
+ if (heightChanged && !isTermuxSession() && !isMultiplexer) {
1060
1064
  logRedraw(`terminal height changed (${this.#previousHeight} -> ${height})`);
1061
1065
  fullRender(true);
1062
1066
  return;