Skip to content

Commit

Permalink
reorganise to fix line numbers cannot be enabled directly entering vi…
Browse files Browse the repository at this point in the history
…ew-mode
  • Loading branch information
guanglinn committed Sep 5, 2024
1 parent 9653fc0 commit 2c1eb74
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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();
Expand Down

0 comments on commit 2c1eb74

Please sign in to comment.