Skip to content

Commit 43e084c

Browse files
committed
Check prefix before emptyline
1 parent 78f085c commit 43e084c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Core/Sources/SuggestionWidget/SyntaxHighlighting.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ func convertToCodeLines(
103103
// remove leading spaces
104104
if commonLeadingSpaceCount > 0 {
105105
let leadingSpaces = String(repeating: " ", count: commonLeadingSpaceCount)
106-
if isEmptyLine(mutable.string) {
107-
mutable.mutableString.setString("")
108-
} else if mutable.string.hasPrefix(leadingSpaces) {
106+
if mutable.string.hasPrefix(leadingSpaces) {
109107
mutable.replaceCharacters(
110108
in: NSRange(location: 0, length: commonLeadingSpaceCount),
111109
with: ""
112110
)
111+
} else if isEmptyLine(mutable.string) {
112+
mutable.mutableString.setString("")
113113
}
114114
}
115115

0 commit comments

Comments
 (0)