From e4fe8122fffae66c9917469f739a370008a2dbad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deniz=20=C5=9Eafak?= Date: Mon, 27 Oct 2025 18:27:07 +0300 Subject: [PATCH] Fix book handler showing old cache when replace_single_newlines changed --- abogen/book_handler.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/abogen/book_handler.py b/abogen/book_handler.py index 4cb49a7..02758f5 100644 --- a/abogen/book_handler.py +++ b/abogen/book_handler.py @@ -366,13 +366,18 @@ class HandlerDialog(QDialog): def _preprocess_content(self): """Pre-process content from the document""" - # Create cache key from file path, modification time, and file type + # Create cache key from file path, modification time, file type, and replace_single_newlines setting try: mod_time = os.path.getmtime(self.book_path) except Exception: mod_time = 0 - cache_key = (self.book_path, mod_time, self.file_type) + # Include replace_single_newlines in cache key since it affects text cleaning + from abogen.utils import load_config + cfg = load_config() + replace_single_newlines = cfg.get("replace_single_newlines", False) + + cache_key = (self.book_path, mod_time, self.file_type, replace_single_newlines) # Check if content is already cached if cache_key in HandlerDialog._content_cache: