- Enhancement: When '{' is inputted and there are contents selected, auto add line breaks and indents.

This commit is contained in:
Roy Qu 2024-02-29 13:36:46 +08:00
parent ee488384a1
commit 7c379509bf
1 changed files with 2 additions and 1 deletions

View File

@ -2826,7 +2826,8 @@ bool Editor::handleBraceCompletion()
} else if (oldSelEnd.ch > trimRight(s2).length()) {
shouldBreakLine = true;
}
shouldAddEndLine = !s2.mid(oldSelEnd.ch).trimmed().isEmpty();
if (shouldBreakLine)
shouldAddEndLine = !s2.mid(oldSelEnd.ch).trimmed().isEmpty();
}
if (shouldBreakLine) {
text = "{" + lineBreak() + text;