Track original scratch content to only write scratch when modified
This commit is contained in:
@@ -313,6 +313,7 @@ class MainPageState extends State<MainPage> with WindowListener {
|
|||||||
Note? _currentlyDisplayedNote;
|
Note? _currentlyDisplayedNote;
|
||||||
Duration _currentPopupInterval = _defaultPopupInterval;
|
Duration _currentPopupInterval = _defaultPopupInterval;
|
||||||
String _currentNotificationSound = _defaultNotificationSound;
|
String _currentNotificationSound = _defaultNotificationSound;
|
||||||
|
String? _originalScratchContent; // Track original scratch content
|
||||||
|
|
||||||
bool _canGoPrevious = false;
|
bool _canGoPrevious = false;
|
||||||
bool _canGoNext = false;
|
bool _canGoNext = false;
|
||||||
@@ -562,6 +563,7 @@ class MainPageState extends State<MainPage> with WindowListener {
|
|||||||
|
|
||||||
final scratch = await getLatestScratch();
|
final scratch = await getLatestScratch();
|
||||||
_scratchController.text = scratch?.content ?? "";
|
_scratchController.text = scratch?.content ?? "";
|
||||||
|
_originalScratchContent = scratch?.content; // Store original content
|
||||||
|
|
||||||
await _checkNavigation();
|
await _checkNavigation();
|
||||||
|
|
||||||
@@ -596,9 +598,10 @@ class MainPageState extends State<MainPage> with WindowListener {
|
|||||||
_currentEntryController.clear(); // Clear the input field after saving
|
_currentEntryController.clear(); // Clear the input field after saving
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scratchContent != _scratchController.text) {
|
// Only create new scratch if content has changed
|
||||||
// Was modified
|
if (scratchContent != _originalScratchContent) {
|
||||||
await createScratch(scratchContent);
|
await createScratch(scratchContent);
|
||||||
|
_originalScratchContent = scratchContent; // Update original content
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle previous/currently displayed note
|
// Handle previous/currently displayed note
|
||||||
|
Reference in New Issue
Block a user