From b05710c52482fc34cb3673d25217766a31268077 Mon Sep 17 00:00:00 2001 From: Akash Yadav Date: Sun, 1 Oct 2023 23:31:53 +0530 Subject: [PATCH] fix(editor): modified status is not changed after content modification --- .../main/java/com/itsaky/androidide/editor/ui/IDEEditor.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/editor/src/main/java/com/itsaky/androidide/editor/ui/IDEEditor.kt b/editor/src/main/java/com/itsaky/androidide/editor/ui/IDEEditor.kt index 4904951a9..0228e1521 100644 --- a/editor/src/main/java/com/itsaky/androidide/editor/ui/IDEEditor.kt +++ b/editor/src/main/java/com/itsaky/androidide/editor/ui/IDEEditor.kt @@ -651,6 +651,8 @@ open class IDEEditor @JvmOverloads constructor( it.init() } + markUnmodified() + searcher = IDEEditorSearcher(this) colorScheme = SchemeAndroidIDE.newInstance(context) inputType = createInputTypeFlags() @@ -662,6 +664,7 @@ open class IDEEditor @JvmOverloads constructor( getComponent(EditorTextActionWindow::class.java).isEnabled = false subscribeEvent(ContentChangeEvent::class.java) { event, _ -> + markModified() file ?: return@subscribeEvent editorScope.launch { @@ -829,6 +832,7 @@ open class IDEEditor @JvmOverloads constructor( } protected open fun dispatchDocumentSelectedEvent() { + markUnmodified() val file = file ?: return val selectedEvent = DocumentSelectedEvent(file.toPath()) EventBus.getDefault().post(selectedEvent)