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;
|
||||
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<MainPage> 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<MainPage> 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
|
||||
|
Reference in New Issue
Block a user