From e51768fcfcf8e3ce557080f53593da0ffc8a588d Mon Sep 17 00:00:00 2001 From: Harshad Vedartham Date: Tue, 12 Jul 2022 14:09:09 -0700 Subject: [PATCH] Don't overwrite newer files unless content modified --- .../net/gsantner/markor/activity/DocumentEditFragment.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/net/gsantner/markor/activity/DocumentEditFragment.java b/app/src/main/java/net/gsantner/markor/activity/DocumentEditFragment.java index 1270b745e1..bf7f11802a 100644 --- a/app/src/main/java/net/gsantner/markor/activity/DocumentEditFragment.java +++ b/app/src/main/java/net/gsantner/markor/activity/DocumentEditFragment.java @@ -691,8 +691,9 @@ public boolean checkPermissions() { // Only supports java.io.File. TODO: Android Content public boolean saveDocument(final boolean forceSaveEmpty) { // Document is written iff writeable && content has changed - if (checkPermissions() && _hlEditor != null && isAdded()) { - if (_document.saveContent(getContext(), _hlEditor.getText(), _shareUtil, forceSaveEmpty)) { + final CharSequence text = _hlEditor.getText(); + if (!_document.isContentSame(text) && checkPermissions() && _hlEditor != null && isAdded()) { + if (_document.saveContent(getContext(), text, _shareUtil, forceSaveEmpty)) { checkTextChangeState(); return true; } else {