| 243 | } |
| 244 | |
| 245 | bool FPythonLogTextLayoutMarshaller::AppendMessage(const TCHAR* InText, const ELogVerbosity::Type InVerbosity, const FName& InCategory) |
| 246 | { |
| 247 | TArray< TSharedPtr<FLogMessage> > NewMessages; |
| 248 | if (SPythonLog::CreateLogMessages(InText, InVerbosity, InCategory, NewMessages)) |
| 249 | { |
| 250 | const bool bWasEmpty = Messages.Num() == 0; |
| 251 | Messages.Append(NewMessages); |
| 252 | |
| 253 | if (TextLayout) |
| 254 | { |
| 255 | // If we were previously empty, then we'd have inserted a dummy empty line into the document |
| 256 | // We need to remove this line now as it would cause the message indices to get out-of-sync with the line numbers, which would break auto-scrolling |
| 257 | if (bWasEmpty) |
| 258 | { |
| 259 | TextLayout->ClearLines(); |
| 260 | } |
| 261 | |
| 262 | // If we've already been given a text layout, then append these new messages rather than force a refresh of the entire document |
| 263 | AppendMessagesToTextLayout(NewMessages); |
| 264 | } |
| 265 | else |
| 266 | { |
| 267 | MakeDirty(); |
| 268 | } |
| 269 | |
| 270 | return true; |
| 271 | } |
| 272 | |
| 273 | return false; |
| 274 | } |
| 275 | |
| 276 | void FPythonLogTextLayoutMarshaller::AppendMessageToTextLayout(const TSharedPtr<FLogMessage>& InMessage) |
| 277 | { |