fix: prevent text plugin from finalizing in update method
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -222,18 +222,16 @@ impl MetaPlugin for TextMetaPlugin {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it's text, count words and lines for this chunk and stop buffering
|
// If it's text, count words and lines for this chunk
|
||||||
self.count_text_stats(&data[..bytes_to_take]);
|
self.count_text_stats(&data[..bytes_to_take]);
|
||||||
|
|
||||||
// If we've reached our buffer limit, drop the buffer but don't finalize yet
|
// If we've reached our buffer limit, drop the buffer to save memory
|
||||||
// We need to wait for finalize() to be called to output word and line counts
|
// But don't finalize yet - we need to keep counting words and lines
|
||||||
if buffer_len >= self.max_buffer_size {
|
if buffer_len >= self.max_buffer_size {
|
||||||
log::debug!("TEXT: Reached max buffer size, dropping buffer but not finalizing");
|
log::debug!("TEXT: Reached max buffer size, dropping buffer but not finalizing");
|
||||||
self.buffer = None; // Drop the buffer
|
self.buffer = None; // Drop the buffer
|
||||||
false // Don't finalize yet
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
}
|
||||||
|
false // Never finalize here for text content
|
||||||
} else {
|
} else {
|
||||||
// Still building up buffer, count words and lines for this chunk
|
// Still building up buffer, count words and lines for this chunk
|
||||||
self.count_text_stats(&data[..bytes_to_take]);
|
self.count_text_stats(&data[..bytes_to_take]);
|
||||||
|
|||||||
Reference in New Issue
Block a user