Skip to content

Commit

Permalink
Merge pull request #945 from vorth/fix-branches
Browse files Browse the repository at this point in the history
Fixed the defect interpreting nested branches
  • Loading branch information
vorth authored Jan 5, 2025
2 parents 99bbd72 + 740d658 commit 84ab190
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion online/src/worker/legacy/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class ParsedEdit

perform( context )
{
console.log( 'perform', this.nativeElement.id, this.nativeElement.tagName );
// console.log( 'perform', this.nativeElement.id, this.nativeElement.tagName );
this.legacyEdit = this.interpret.call( this, this.nativeElement, context );
}

Expand Down
14 changes: 8 additions & 6 deletions online/src/worker/legacy/interpreter.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,16 @@ export class Interpreter
let top;
do {
top = this.stack .pop();
if ( !! top ) {
this.cursor .endBranch( top.branch );
this.cursor = top.cursor; // overwrite and discard the prior value
this.cursor .setNextEdit( top.branch .nextSibling() );
}
} while ( top && ! top.branch .nextSibling() )
if ( top ) {
this.cursor = top.cursor; // overwrite and discard the prior value
this.cursor .endBranch( top.branch );
this.cursor .setNextEdit( top.branch .nextSibling() );
return breakpointHit? Step.DONE : Step.OUT;
return breakpointHit? Step.DONE : Step.OUT; // at the end of a branch
} else {
// at the end of the editHistory
return Step.DONE;
return Step.DONE; // at the end of the editHistory
}
}
}
Expand Down Expand Up @@ -222,6 +223,7 @@ export class EditCursor
for (const edit of reversed) {
const trueEdit = edit .legacyEdit;
if ( trueEdit ) {
// console.log( 'undo', edit.nativeElement.id, edit.nativeElement.tagName );
trueEdit .undo();
} else
console.log( 'No true edit?' );
Expand Down

0 comments on commit 84ab190

Please sign in to comment.