mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-24 04:52:43 -07:00
Fix issue where we were passing the model content reflecting terminal line wrapping. (#14566)
This commit is contained in:
@@ -116,8 +116,28 @@ const getFullBufferText = (terminal: pkg.Terminal): string => {
|
||||
const lines: string[] = [];
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
const line = buffer.getLine(i);
|
||||
const lineContent = line ? line.translateToString(true) : '';
|
||||
lines.push(lineContent);
|
||||
if (!line) {
|
||||
continue;
|
||||
}
|
||||
// If the NEXT line is wrapped, it means it's a continuation of THIS line.
|
||||
// We should not trim the right side of this line because trailing spaces
|
||||
// might be significant parts of the wrapped content.
|
||||
// If it's not wrapped, we trim normally.
|
||||
let trimRight = true;
|
||||
if (i + 1 < buffer.length) {
|
||||
const nextLine = buffer.getLine(i + 1);
|
||||
if (nextLine?.isWrapped) {
|
||||
trimRight = false;
|
||||
}
|
||||
}
|
||||
|
||||
const lineContent = line.translateToString(trimRight);
|
||||
|
||||
if (line.isWrapped && lines.length > 0) {
|
||||
lines[lines.length - 1] += lineContent;
|
||||
} else {
|
||||
lines.push(lineContent);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove trailing empty lines
|
||||
|
||||
Reference in New Issue
Block a user