Skip to content

Commit

Permalink
Fix bugs in undo/redo and paste for JSON settings.
Browse files Browse the repository at this point in the history
* Normalize in the `input` event that follows a `beforeinput`
  event, rather than in the later-queued microtask. This could be
  important if the microtask runs after *multiple* events that
  install multiple commands.

* Improve normalization, which did not always return the correct
  first element. (normalize should return the first line element
  in the normalized range; but if the first line element was a
  multi-line <div> -- e.g., <div><div>a<br>b<br>c</div></div> --
  it did not.)

* Track more DOM modifications in the window selection object.

* Do not combine modifications that have already been undone.
  • Loading branch information
kohler committed Jan 5, 2024
1 parent 65a4636 commit 7b589be
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 112 deletions.
2 changes: 1 addition & 1 deletion scripts/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -8024,7 +8024,7 @@ function suggest() {
repl += " ";
spacestate = hintinfo.smart_punctuation ? outPos : -1;
}
if (endPos < 0) {
if (startPos < 0 || endPos < 0 || startPos > endPos || endPos > val.length) {
let x = Object.assign({}, hintinfo);
delete x.items;
log_jserror(JSON.stringify({value:val,hint:x,repl:repl,startPos:startPos,endPos:endPos}));
Expand Down
Loading

0 comments on commit 7b589be

Please sign in to comment.