diff --git a/README.md b/README.md new file mode 100644 index 0000000..a1b5b77 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# Miller code editor + +This is a code editor/IDE based on CodeMirror. +Its primary goal is to provide the user with a stack/column-based navigation history, making codebase navigation easier without getting lost. \ No newline at end of file diff --git a/src/app/filestate.ts b/src/app/filestate.ts index 6ad5b01..1c726e8 100644 --- a/src/app/filestate.ts +++ b/src/app/filestate.ts @@ -4,6 +4,7 @@ import { TransactionSpec, StateEffect, Text, + Transaction, } from "@codemirror/state"; import { history } from "@codemirror/commands"; import { Editor } from "./editor"; @@ -74,14 +75,20 @@ export class OpenFile { } dispatch(trs: TransactionSpec, origin?: Editor) { - this.rootState.val = this.rootState.val.update(trs).state; + let transaction = this.rootState.val.update(trs); + this.rootState.val = transaction.state; if (origin) { const es = this.editors.filter((e) => e !== origin); es.forEach((e) => e.dispatch(e.view.state.update(trs), true)); } else { - this.editors.forEach((e) => - e.dispatch(e.view.state.update(trs), true), - ); + this.editors.forEach((e) => { + let changes = transaction.changes; + let userEvent = transaction.annotation(Transaction.userEvent); + let annotations = userEvent + ? [Transaction.userEvent.of(userEvent)] + : []; + e.dispatch(e.view.state.update({ changes, annotations }), true); + }); } }