Skip to content

Commit 1582959

Browse files
committed
Fix keywords sometimes not highlighted in multiln
When enter pressed immediately after keyword, the highlighting would be aborted
1 parent 29fc55a commit 1582959

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/dotty/tools/dotc/printing/SyntaxHighlighting.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,12 @@ object SyntaxHighlighting {
221221
val sb = new StringBuilder(s"$c")
222222
while (remaining.nonEmpty && curr != ' ' && curr != '(' && curr != '\n') {
223223
curr = takeChar()
224-
if (curr != ' ') sb += curr
224+
if (curr != ' ' && curr != '\n') sb += curr
225225
}
226226

227227
val str = sb.toString
228228
val toAdd = if (shouldHL(str)) highlight(str) else str
229-
val suffix = if (curr == ' ') " " else ""
229+
val suffix = if (curr == ' ' || curr == '\n') s"$curr" else ""
230230
newBuf append (toAdd + suffix)
231231
prev = curr
232232
}

0 commit comments

Comments
 (0)