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

Method _renderInput

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

Source from the content-addressed store, hash-verified

463 }
464
465 _renderInput() {
466 let buf = '';
467 const row = this.chatHeight + 1;
468 const t = this.theme;
469
470 // Command palette (floating above input when typing a slash command)
471 if (this.commandPaletteOpen) {
472 buf += this._renderCommandPalette(row);
473 }
474
475 // Thin separator line
476 buf += ANSI.moveTo(row, 1);
477 buf += t.border + BOX.horizontal.repeat(this.width) + ANSI.reset;
478
479 // Input area — wraps vertically for long text
480 const inputAvail = this.width - 5; // "│ > " prefix / "│ " continuation
481 const inputLines = visualWrap(this.inputBuffer, inputAvail);
482
483 // Render each wrapped line
484 for (let i = 0; i < inputLines.length && i < 6; i++) {
485 buf += ANSI.moveTo(row + 1 + i, 1);
486 buf += t.inputBg + t.border + BOX.vertical + ANSI.reset + t.inputBg;
487 if (i === 0) {
488 buf += t.muted + ' > ' + ANSI.reset + t.inputBg + t.fg;
489 } else {
490 buf += ' ' + t.inputBg + t.fg;
491 }
492 buf += inputLines[i];
493 const lineVisualLen = visualLength(inputLines[i]);
494 buf += ' '.repeat(Math.max(0, inputAvail - lineVisualLen));
495 buf += ANSI.reset;
496 }
497
498 // Clear remaining input area lines
499 for (let i = inputLines.length; i < this.inputHeight - 2; i++) {
500 buf += ANSI.moveTo(row + 1 + i, 1);
501 buf += ' '.repeat(this.width);
502 }
503
504 // Hint line
505 const hintRow = row + this.inputHeight - 1;
506 buf += ANSI.moveTo(hintRow, 1);
507 if (this.commandPaletteOpen) {
508 buf += t.muted + ' ↑↓ navigate enter select esc cancel' + ANSI.reset;
509 } else if (inputLines.length > 1) {
510 buf += t.muted + ` ${this.inputBuffer.length} chars` + ANSI.reset;
511 } else {
512 buf += t.muted + '' + ANSI.reset;
513 }
514
515 return buf;
516 }
517
518 _renderCommandPalette(inputRow) {
519 let buf = '';

Callers 1

renderMethod · 0.95

Calls 3

_renderCommandPaletteMethod · 0.95
visualWrapFunction · 0.85
visualLengthFunction · 0.85

Tested by

no test coverage detected