From dd217d6c6a767c6345a7406855c25ceccb2a86b6 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Tue, 26 Aug 2025 20:57:17 -0300 Subject: [PATCH] fix: prevent text plugin from finalizing in update method Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) --- src/meta_plugin/text.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/meta_plugin/text.rs b/src/meta_plugin/text.rs index b2af758..aab3cda 100644 --- a/src/meta_plugin/text.rs +++ b/src/meta_plugin/text.rs @@ -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]); - // If we've reached our buffer limit, drop the buffer but don't finalize yet - // We need to wait for finalize() to be called to output word and line counts + // If we've reached our buffer limit, drop the buffer to save memory + // But don't finalize yet - we need to keep counting words and lines if buffer_len >= self.max_buffer_size { log::debug!("TEXT: Reached max buffer size, dropping buffer but not finalizing"); self.buffer = None; // Drop the buffer - false // Don't finalize yet - } else { - false } + false // Never finalize here for text content } else { // Still building up buffer, count words and lines for this chunk self.count_text_stats(&data[..bytes_to_take]);