This commit is contained in:
世界
2024-11-20 12:03:16 +08:00
parent 348f2809a1
commit 286f9717cb
+6 -4
View File
@@ -171,12 +171,14 @@ public class CommandClient: ObservableObject {
return return
} }
DispatchQueue.main.async { [self] in DispatchQueue.main.async { [self] in
if commandClient.logList.count >= commandClient.logMaxLines { var newLogList = commandClient.logList
commandClient.logList.removeFirst()
}
while messageList.hasNext() { while messageList.hasNext() {
commandClient.logList.append(messageList.next()) newLogList.append(messageList.next())
} }
if newLogList.count >= commandClient.logMaxLines {
newLogList.removeSubrange(0...newLogList.count-commandClient.logMaxLines)
}
commandClient.logList = newLogList
} }
} }