From 788eb86d840609e4ee34dc57a43af795e872e5ea Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sun, 21 Mar 2021 17:57:32 -0400 Subject: [PATCH] Ace2Inner: Inline code that is unnecessarily inside an IIFE --- src/static/js/ace2_inner.js | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 73a4f281c..4672751dc 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -1475,27 +1475,25 @@ function Ace2Inner(editorInfo, cssManagers) { throw new Error(`doRepApplyChangeset length mismatch: ${errMsg}`); } - ((changes) => { - const editEvent = currentCallStack.editEvent; - if (editEvent.eventType === 'nonundoable') { - if (!editEvent.changeset) { - editEvent.changeset = changes; - } else { - editEvent.changeset = Changeset.compose(editEvent.changeset, changes, rep.apool); - } + const editEvent = currentCallStack.editEvent; + if (editEvent.eventType === 'nonundoable') { + if (!editEvent.changeset) { + editEvent.changeset = changes; } else { - const inverseChangeset = Changeset.inverse(changes, { - get: (i) => `${rep.lines.atIndex(i).text}\n`, - length: () => rep.lines.length(), - }, rep.alines, rep.apool); - - if (!editEvent.backset) { - editEvent.backset = inverseChangeset; - } else { - editEvent.backset = Changeset.compose(inverseChangeset, editEvent.backset, rep.apool); - } + editEvent.changeset = Changeset.compose(editEvent.changeset, changes, rep.apool); } - })(changes); + } else { + const inverseChangeset = Changeset.inverse(changes, { + get: (i) => `${rep.lines.atIndex(i).text}\n`, + length: () => rep.lines.length(), + }, rep.alines, rep.apool); + + if (!editEvent.backset) { + editEvent.backset = inverseChangeset; + } else { + editEvent.backset = Changeset.compose(inverseChangeset, editEvent.backset, rep.apool); + } + } Changeset.mutateAttributionLines(changes, rep.alines, rep.apool);