diff --git a/app/src/main/java/net/gsantner/markor/activity/DocumentEditAndViewFragment.java b/app/src/main/java/net/gsantner/markor/activity/DocumentEditAndViewFragment.java index c828cb1eb7..c1034d358b 100644 --- a/app/src/main/java/net/gsantner/markor/activity/DocumentEditAndViewFragment.java +++ b/app/src/main/java/net/gsantner/markor/activity/DocumentEditAndViewFragment.java @@ -193,14 +193,6 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { setViewModeVisibility(startInPreview, false); } - _hlEditor.setSaveInstanceState(false); // We will reload from disk - _document.resetChangeTracking(); // Force next reload - loadDocument(); - // If not set the undo-redo helper by loadDocument, set it here - if (_editTextUndoRedoHelper == null) { - _editTextUndoRedoHelper = new TextViewUndoRedo(_hlEditor); - } - // Configure the editor. Doing so after load helps prevent some errors // --------------------------------------------------------- _hlEditor.setLineSpacing(0, _appSettings.getEditorLineSpacing()); @@ -223,6 +215,14 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { updateMenuToggleStates(0); // --------------------------------------------------------- + _hlEditor.setSaveInstanceState(false); // We will reload from disk + _document.resetChangeTracking(); // Force next reload + loadDocument(); + // If not set the undo-redo helper by loadDocument, set it here + if (_editTextUndoRedoHelper == null) { + _editTextUndoRedoHelper = new TextViewUndoRedo(_hlEditor); + } + final Runnable debounced = TextViewUtils.makeDebounced(500, () -> { checkTextChangeState(); updateUndoRedoIconStates();