Skip to content

Commit

Permalink
Fix new lines sometimes ignored in streaming plugins #277
Browse files Browse the repository at this point in the history
  • Loading branch information
melonamin committed Feb 6, 2022
1 parent 5b85986 commit 4ecfe10
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion SwiftBar/Plugin/StreamablePlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,15 @@ class StreamablePlugin: Plugin {
}
// Process trailing separator
if str.contains(streamSeparator) {
str.components(separatedBy: .whitespacesAndNewlines).forEach { s in
// we expect streamSeparator on a separate line
str.components(separatedBy: .newlines).forEach { s in
if s == streamSeparator {
self?.content = self?.streamInProgressContent
self?.streamInProgressContent.removeAll()
return
}
self?.streamInProgressContent.append(s)
self?.streamInProgressContent.append("\n")
}
return
}
Expand Down

0 comments on commit 4ecfe10

Please sign in to comment.