mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-10 22:41:14 +00:00
fix: prevent negative line index when maxReadFileLine is zero (#1915)
When maxReadFileLine setting was set to zero, the code would attempt to read lines with a negative end index (maxReadFileLine - 1 = -1), causing the readLines function to reject the request. This change: - Checks if maxReadFileLine is greater than zero before calling readLines - Returns an empty string when maxReadFileLine is zero - Ensures content is only formatted with line numbers when it's not empty Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org> Co-authored-by: Eric Wheeler <roo-code@z.ewheeler.org>
This commit is contained in:
parent
2597347e91
commit
b41dd739f3
1 changed files with 2 additions and 2 deletions
|
|
@ -2341,11 +2341,11 @@ export class Cline extends EventEmitter<ClineEvents> {
|
|||
isFileTruncated = true
|
||||
|
||||
const res = await Promise.all([
|
||||
readLines(absolutePath, maxReadFileLine - 1, 0),
|
||||
maxReadFileLine > 0 ? readLines(absolutePath, maxReadFileLine - 1, 0) : "",
|
||||
parseSourceCodeDefinitionsForFile(absolutePath, this.rooIgnoreController),
|
||||
])
|
||||
|
||||
content = addLineNumbers(res[0])
|
||||
content = res[0].length > 0 ? addLineNumbers(res[0]) : ""
|
||||
const result = res[1]
|
||||
if (result) {
|
||||
sourceCodeDef = `\n\n${result}`
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue