mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 06:02:42 +00:00
Fix image rendering artifacts and improve show-images selector
- Image component returns correct number of lines (rows) for TUI accounting - Empty lines rendered first, then cursor moves up and image is drawn - This clears the space the image occupies before rendering - Add spacer before inline images in tool output - Create ShowImagesSelectorComponent with borders like other selectors - Use showSelector pattern for /show-images command
This commit is contained in:
parent
883b6b3f9f
commit
e4e234ecff
5 changed files with 81 additions and 70 deletions
|
|
@ -60,7 +60,16 @@ export class Image implements Component {
|
|||
const result = renderImage(this.base64Data, this.dimensions, { maxWidthCells: maxWidth });
|
||||
|
||||
if (result) {
|
||||
lines = [result.sequence];
|
||||
// Return `rows` lines so TUI accounts for image height
|
||||
// First (rows-1) lines are empty (TUI clears them)
|
||||
// Last line: move cursor back up, then output image sequence
|
||||
lines = [];
|
||||
for (let i = 0; i < result.rows - 1; i++) {
|
||||
lines.push("");
|
||||
}
|
||||
// Move cursor up to first row, then output image
|
||||
const moveUp = result.rows > 1 ? `\x1b[${result.rows - 1}A` : "";
|
||||
lines.push(moveUp + result.sequence);
|
||||
} else {
|
||||
const fallback = imageFallback(this.mimeType, this.dimensions, this.options.filename);
|
||||
lines = [this.theme.fallbackColor(fallback)];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue