Skip to content

Commit

Permalink
don't raise events in FixInvalidInput to prevent caret movement in undo
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobhellermann committed Sep 4, 2024
1 parent e3db2c0 commit 134d6e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Studio/CelesteStudio/Editing/Document.cs
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,10 @@ public void InsertLines(int row, string[] newLines) {
}

public void ReplaceLine(int row, string text) {
if (Lines[row] == text) {
return;
}

var newLines = text.SplitDocumentLines();
ReplaceLines(row, newLines);
}
Expand Down
2 changes: 1 addition & 1 deletion Studio/CelesteStudio/Editing/Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ public void FixInvalidInputs() {
}
}
private void FixInvalidInput(int row) {
using var __ = Document.Update();
using var __ = Document.Update(raiseEvents: false);

// Frameless action lines are only intended for editing and shouldn't be part of the final TAS
if (ActionLine.TryParse(Document.Lines[row], out var actionLine)) {
Expand Down

0 comments on commit 134d6e9

Please sign in to comment.