@pi-archimedes/core 1.0.0 → 1.2.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 +1 -1
- package/src/startup/index.ts +10 -9
package/package.json
CHANGED
package/src/startup/index.ts
CHANGED
|
@@ -126,8 +126,9 @@ export function renderHeader(theme: Theme, ref: ListingRef, width: number, heigh
|
|
|
126
126
|
//
|
|
127
127
|
// Strategy (most specific → least specific):
|
|
128
128
|
// 1. Container with "Scrollable" in constructor name
|
|
129
|
-
// 2.
|
|
130
|
-
//
|
|
129
|
+
// 2. Middle child — TUI layout is [headerContainer, chatContainer, footer]
|
|
130
|
+
// This is position-stable even when chatContainer is empty (e.g. after clear)
|
|
131
|
+
// 3. Container with most children (chat usually has the most)
|
|
131
132
|
// 4. First Container found
|
|
132
133
|
function findChatContainer(tui: TUI): Container | undefined {
|
|
133
134
|
// Strategy 1: Look for Scrollable container
|
|
@@ -137,7 +138,13 @@ function findChatContainer(tui: TUI): Container | undefined {
|
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
|
|
140
|
-
// Strategy 2:
|
|
141
|
+
// Strategy 2: Middle child — TUI layout is [headerContainer, chatContainer, footer]
|
|
142
|
+
if (tui.children.length >= 3) {
|
|
143
|
+
const middle = tui.children[1];
|
|
144
|
+
if (middle instanceof Container) return middle;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Strategy 3: Find the Container with the most children (chat area)
|
|
141
148
|
const containers = tui.children.filter((c): c is Container => c instanceof Container);
|
|
142
149
|
if (containers.length > 1) {
|
|
143
150
|
const largest = containers.reduce((best, c) =>
|
|
@@ -146,12 +153,6 @@ function findChatContainer(tui: TUI): Container | undefined {
|
|
|
146
153
|
if (largest.children.length > 0) return largest;
|
|
147
154
|
}
|
|
148
155
|
|
|
149
|
-
// Strategy 3: Middle child if exactly 3 children
|
|
150
|
-
if (tui.children.length >= 3) {
|
|
151
|
-
const middle = tui.children[1];
|
|
152
|
-
if (middle instanceof Container) return middle;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
156
|
// Strategy 4: First Container
|
|
156
157
|
if (containers.length > 0) return containers[0];
|
|
157
158
|
|