MCPcopy
hub / github.com/Doorman11991/smallcode / _computeLayout

Method _computeLayout

src/tui/fullscreen.js:265–284  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

263 // ─── Layout ──────────────────────────────────────────────────────────
264
265 _computeLayout() {
266 this.width = process.stdout.columns || 80;
267 this.height = process.stdout.rows || 24;
268
269 // Dynamic input height: grows with content (min 3, max 8 lines)
270 const inputAvail = this.width - 5;
271 const inputVisualLen = visualLength(this.inputBuffer);
272 const wrappedLines = inputAvail > 0 ? Math.ceil(Math.max(1, inputVisualLen) / inputAvail) : 1;
273 this.inputHeight = Math.min(8, Math.max(3, wrappedLines + 2)); // +2 for border + hint
274
275 this.chatHeight = this.height - this.inputHeight - this.statusHeight;
276
277 if (this.showToolPanel && this.width > 100) {
278 this.chatWidth = Math.floor(this.width * 0.65);
279 this.toolWidth = this.width - this.chatWidth - 1;
280 } else {
281 this.chatWidth = this.width;
282 this.toolWidth = 0;
283 }
284 }
285
286 // ─── Rendering ─────────────────────────────────────────────────────
287

Callers 5

constructorMethod · 0.95
enterMethod · 0.95
renderMethod · 0.95
_onResizeMethod · 0.95
tui_layout.test.jsFile · 0.80

Calls 1

visualLengthFunction · 0.85

Tested by

no test coverage detected