Skip to content

Commit

Permalink
Fix some code-style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
psyGamer committed Jul 25, 2024
1 parent 7568e99 commit 0caa1e1
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions Studio/CelesteStudio/Editing/Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2058,7 +2058,7 @@ private void CombineInputs(bool sameActions) {
}

private void SplitLines() {
using var _ = Document.Update();
using var __ = Document.Update();

(int minRow, int maxRow) = Document.Selection.Empty
? (Document.Caret.Row, Document.Caret.Row)
Expand All @@ -2067,16 +2067,12 @@ private void SplitLines() {
int extraLines = 0;

for (int row = maxRow; row >= minRow; row--) {
if (!TryParseAndFormatActionLine(row, out var currActionLine))
continue;

if (currActionLine.Frames == 0) {
if (!ActionLine.TryParse(Document.Lines[row], out var actionLine) || actionLine.Frames == 0) {
continue;
}

extraLines += currActionLine.Frames - 1;
var currentActionSingleFrame = currActionLine with {Frames = 1};
Document.ReplaceLines(row, Enumerable.Repeat(currentActionSingleFrame.ToString(), currActionLine.Frames).ToArray());
extraLines += actionLine.Frames - 1;
Document.ReplaceLines(row, Enumerable.Repeat((actionLine with { Frames = 1 }).ToString(), actionLine.Frames).ToArray());
}

if (!Document.Selection.Empty) {
Expand Down

0 comments on commit 0caa1e1

Please sign in to comment.