| 92 | } |
| 93 | |
| 94 | EmittedLines CGitCliOutputParser::Process(const std::string_view buffer) |
| 95 | { |
| 96 | EmittedLines out; |
| 97 | bool foundCr = false; |
| 98 | for (const char ch : buffer) |
| 99 | { |
| 100 | if (ch == '\r' || ch == '\n') |
| 101 | { |
| 102 | HandleLine(out, m_currentLine, ch == '\r'); |
| 103 | if (ch == '\r') |
| 104 | foundCr = true; |
| 105 | m_currentLine.clear(); |
| 106 | if (out.limited) |
| 107 | break; // do not add info on overall length limitation here as the richedit may be longer due to line breaks; break is enough as we do not get called any more later on |
| 108 | continue; |
| 109 | } |
| 110 | |
| 111 | m_currentLine.push_back(ch); |
| 112 | } |
| 113 | |
| 114 | if (!m_pendingCR.empty() && foundCr) |
| 115 | { |
| 116 | // Do not make a skipped empty remote CR visible. |
| 117 | // It is only a temporary placeholder after a previous remote: LF/CR sequence |
| 118 | // and may still be replaced by the next real remote line. |
| 119 | if (!(m_skipNextEmptyRemoteLF && IsEmptyRemoteLine(m_pendingCR))) |
| 120 | { |
| 121 | out.text.append(m_pendingCR); |
| 122 | m_pendingVisible = true; |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | return out; |
| 127 | } |
| 128 | |
| 129 | void CGitCliOutputParser::Reset() |
| 130 | { |