diff --git a/fleet/andel/srcCommonMain/andel/editor/MutableEditor.kt b/fleet/andel/srcCommonMain/andel/editor/MutableEditor.kt index 4a8bc96288ce..429db79396ad 100644 --- a/fleet/andel/srcCommonMain/andel/editor/MutableEditor.kt +++ b/fleet/andel/srcCommonMain/andel/editor/MutableEditor.kt @@ -116,6 +116,7 @@ interface Editor { val layout: EditorLayout val composableTextRange: TextRange? + val timestamp: Long } interface MutableEditor : Editor { diff --git a/fleet/andel/srcCommonMain/andel/editor/SimpleEditor.kt b/fleet/andel/srcCommonMain/andel/editor/SimpleEditor.kt index 9e88c56505b3..d9eaf2d8f6a5 100644 --- a/fleet/andel/srcCommonMain/andel/editor/SimpleEditor.kt +++ b/fleet/andel/srcCommonMain/andel/editor/SimpleEditor.kt @@ -72,7 +72,8 @@ fun simpleEditor( xKind = EditorScrollKind.Smallest, yKind = EditorScrollKind.Smallest, timestamp = scrollCommandTimestamp) - else null + else null, + timestamp = 0 ) } @@ -142,6 +143,7 @@ data class SimpleEditorState( val focusPlace: EditorFocusPlace, val userActionTimestamp: Map = emptyMap(), override val composableTextRange: TextRange? = null, + override val timestamp: Long ) : Editor { override val undoLog: UndoLog get() = document.undoLog override val layout: EditorLayout @@ -163,6 +165,7 @@ fun SimpleEditorState.mutate(f: MutableEditor.() -> Unit): SimpleEditorState { SimpleMutableMultiCaret(mutableDocument, multiCaret), oneLine, writable, + timestamp, editorLayoutComponent, focusPlace, scrollCommand, @@ -176,7 +179,8 @@ fun SimpleEditorState.mutate(f: MutableEditor.() -> Unit): SimpleEditorState { scrollCommand = mutableEditor.scrollCommand, focusPlace = mutableEditor.focusPlace, userActionTimestamp = mutableEditor.userActionTimestamp, - composableTextRange = mutableEditor.composableTextRange) + composableTextRange = mutableEditor.composableTextRange, + timestamp = documentStateAfter.timestamp + 1) } data class SimpleMultiCaretState( @@ -272,6 +276,7 @@ class SimpleMutableEditor( override val multiCaret: SimpleMutableMultiCaret, override val oneLine: Boolean, override val writable: Boolean, + override val timestamp: Long, val editorLayout: SimpleEditorLayoutComponent, var focusPlace: EditorFocusPlace, override var scrollCommand: EditorScrollCommand?,