fix: render clearing bug and expand containment field
This commit is contained in:
parent
2ec00018bd
commit
ce12c51435
2 changed files with 3 additions and 3 deletions
2
index.ts
2
index.ts
|
|
@ -43,7 +43,7 @@ async function main() {
|
||||||
messages.push({ role: "user", content: prompt });
|
messages.push({ role: "user", content: prompt });
|
||||||
|
|
||||||
const { fullStream, textStream, text, totalUsage } = streamText({
|
const { fullStream, textStream, text, totalUsage } = streamText({
|
||||||
model: provider(args.model ?? "gemma4-26b-a4b"),
|
model: provider(args.model ?? "qwen3.5-35b-a3b"),
|
||||||
messages,
|
messages,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,12 +38,12 @@ export default class StreamRenderer {
|
||||||
if (text.includes("\n")) {
|
if (text.includes("\n")) {
|
||||||
this.lineCount += text.match(/\n/g)?.length ?? 1;
|
this.lineCount += text.match(/\n/g)?.length ?? 1;
|
||||||
this.charsSinceNL = text.length - text.lastIndexOf("\n") - 1;
|
this.charsSinceNL = text.length - text.lastIndexOf("\n") - 1;
|
||||||
} else if (this.charsSinceNL >= columns) {
|
} else if (this.charsSinceNL > columns) {
|
||||||
this.lineCount++;
|
this.lineCount++;
|
||||||
this.charsSinceNL = this.charsSinceNL - columns;
|
this.charsSinceNL = this.charsSinceNL - columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.lineCount >= rows / 2) {
|
if (this.lineCount >= Math.floor(rows * 0.75)) {
|
||||||
this.moveCursor(0, -this.lineCount);
|
this.moveCursor(0, -this.lineCount);
|
||||||
this.clearScreenDown();
|
this.clearScreenDown();
|
||||||
this.lineCount = 0;
|
this.lineCount = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue