refactor: remove LineRangeFilter implementation
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -421,50 +421,3 @@ impl ItemService {
|
||||
|
||||
}
|
||||
|
||||
self.current_line += 1;
|
||||
if self.current_line >= start_line {
|
||||
self.in_range = true;
|
||||
self.buffer_pos += 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
self.buffer_pos += 1;
|
||||
}
|
||||
// If we're still not in range, continue reading
|
||||
if !self.in_range {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Now we're in the range, copy data until we reach the end line or buffer end
|
||||
if self.in_range && self.current_line <= end_line {
|
||||
let bytes_to_copy = std::cmp::min(
|
||||
buf.len() - bytes_written,
|
||||
self.buffer.len() - self.buffer_pos
|
||||
);
|
||||
|
||||
// Check if we encounter a newline that would take us past the end line
|
||||
for i in 0..bytes_to_copy {
|
||||
let byte = self.buffer[self.buffer_pos + i];
|
||||
buf[bytes_written + i] = byte;
|
||||
|
||||
if byte == b'\n' {
|
||||
self.current_line += 1;
|
||||
if self.current_line > end_line {
|
||||
// We've reached the end of the range
|
||||
self.buffer_pos += i + 1;
|
||||
return Ok(bytes_written + i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bytes_written += bytes_to_copy;
|
||||
self.buffer_pos += bytes_to_copy;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(bytes_written)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user