From 188619478ee86789f7cdaa71fe5e468f8129b2ba Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Sun, 25 May 2025 10:11:35 +0200 Subject: [PATCH] Track original scratch content to only write scratch when modified --- lib/main.dart | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 7a10bcb..7c822f0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -313,6 +313,7 @@ class MainPageState extends State with WindowListener { Note? _currentlyDisplayedNote; Duration _currentPopupInterval = _defaultPopupInterval; String _currentNotificationSound = _defaultNotificationSound; + String? _originalScratchContent; // Track original scratch content bool _canGoPrevious = false; bool _canGoNext = false; @@ -562,6 +563,7 @@ class MainPageState extends State with WindowListener { final scratch = await getLatestScratch(); _scratchController.text = scratch?.content ?? ""; + _originalScratchContent = scratch?.content; // Store original content await _checkNavigation(); @@ -596,9 +598,10 @@ class MainPageState extends State with WindowListener { _currentEntryController.clear(); // Clear the input field after saving } - if (scratchContent != _scratchController.text) { - // Was modified + // Only create new scratch if content has changed + if (scratchContent != _originalScratchContent) { await createScratch(scratchContent); + _originalScratchContent = scratchContent; // Update original content } // Handle previous/currently displayed note