| 185 | } |
| 186 | |
| 187 | void CGitCliOutputParser::HandleLine(EmittedLines& out, const std::string& line, bool endedWithCR) |
| 188 | { |
| 189 | const bool remoteLine = IsRemoteLine(line); |
| 190 | const bool pendingRemoteLine = IsRemoteLine(m_pendingCR); |
| 191 | const bool emptyRemote = remoteLine && IsEmptyRemoteLine(line); |
| 192 | |
| 193 | if (endedWithCR) |
| 194 | { |
| 195 | if (m_pendingCR.empty()) |
| 196 | { |
| 197 | m_pendingCR = line; |
| 198 | return; |
| 199 | } |
| 200 | |
| 201 | if (pendingRemoteLine && remoteLine) |
| 202 | { |
| 203 | const bool preserveSkip = m_skipNextEmptyRemoteLF && emptyRemote; |
| 204 | if (!preserveSkip) |
| 205 | m_skipNextEmptyRemoteLF = false; |
| 206 | |
| 207 | if (!emptyRemote) |
| 208 | DiscardPendingCR(out); |
| 209 | else if (!m_skipNextEmptyRemoteLF) |
| 210 | MakePendingPermanent(out); |
| 211 | |
| 212 | m_pendingCR = line; |
| 213 | |
| 214 | return; |
| 215 | } |
| 216 | |
| 217 | // Normal console CR behavior |
| 218 | EraseVisiblePendingIfNeeded(out); |
| 219 | m_pendingCR = OverlayConsoleLine(m_pendingCR, line); |
| 220 | return; |
| 221 | } |
| 222 | |
| 223 | // LF line without pending CR |
| 224 | if (m_pendingCR.empty()) |
| 225 | { |
| 226 | if (!m_skipNextEmptyRemoteLF || !emptyRemote) |
| 227 | AppendLine(out, line); |
| 228 | |
| 229 | m_skipNextEmptyRemoteLF = false; |
| 230 | return; |
| 231 | } |
| 232 | |
| 233 | if (pendingRemoteLine && remoteLine) |
| 234 | { |
| 235 | m_skipNextEmptyRemoteLF = emptyRemote; |
| 236 | |
| 237 | if (emptyRemote && !IsEmptyRemoteLine(m_pendingCR)) |
| 238 | { |
| 239 | MakePendingPermanent(out); |
| 240 | return; |
| 241 | } |
| 242 | |
| 243 | DiscardPendingCR(out); |
| 244 | AppendLine(out, line); |
nothing calls this directly
no test coverage detected