Skip to content

Commit

Permalink
Properly map inverted effects when combining history events
Browse files Browse the repository at this point in the history
FIX: Fix a bug in the undo history that would cause it to incorrectly track inverted
effects when adding multiple edits to a single history event.

Issue codemirror/dev#1431
  • Loading branch information
marijnh committed Aug 31, 2024
1 parent 99bc904 commit 35f5dcc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ class HistoryState {
// For compose (but not compose.start) events, always join with previous event
userEvent == "input.type.compose")) {
done = updateBranch(done, done.length - 1, config.minDepth,
new HistEvent(event.changes.compose(lastEvent.changes), conc(event.effects, lastEvent.effects),
new HistEvent(event.changes.compose(lastEvent.changes),
conc(StateEffect.mapEffects(event.effects, lastEvent.changes), lastEvent.effects),
lastEvent.mapped, lastEvent.startSelection, none))
} else {
done = updateBranch(done, done.length, config.minDepth, event)
Expand Down

0 comments on commit 35f5dcc

Please sign in to comment.