Skip to content

Commit

Permalink
tweak(Studio): Restrict multi-line comments to only "# "
Browse files Browse the repository at this point in the history
  • Loading branch information
psyGamer committed Oct 27, 2024
1 parent 6ec2140 commit 51ac33a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Studio/CelesteStudio/Editing/Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2625,10 +2625,8 @@ private void OnEnter(bool splitLines, bool up) {
line = Document.Lines[Document.Caret.Row];
}

string prefix = "";
if (line.StartsWith('#')) {
prefix = new(line.TakeWhile(c => c == '#' || char.IsWhiteSpace(c)).ToArray());
}
// Auto-insert # for multiline comments (not labels, not folds!)
string prefix = line.StartsWith("# ") ? "# " : "";
Document.Caret.Col = Math.Max(Document.Caret.Col, prefix.Length);

string beforeCaret = line[prefix.Length..Document.Caret.Col];
Expand Down

0 comments on commit 51ac33a

Please sign in to comment.