message: [terminal] Parser: Improve processing loop to not just quick scan for ASCII terxt at the beginning of a chunk.
diff: #include <fmt/format.h>
  -#include <range/v3/view/subrange.hpp>
  -
  #if defined(__SSE2__)
  #include <immintrin.h>
  #endif
  @@ -87,7 +85,9 @@ void Parser::parseFragment(string_view _data)
  auto input = reinterpret_cast<uint8_t const*>(_data.data());
  auto end = reinterpret_cast<uint8_t const*>(_data.data() + _data.size());
  - if (state_ == State::Ground)
  + do
  + {
  + if (state_ == State::Ground && !utf8DecoderState_.expectedLength)
  {
  if (auto count = countAsciiTextChars(input, end); count > 0)
  {
  @@ -98,14 +98,19 @@ void Parser::parseFragment(string_view _data)
  static constexpr char32_t ReplacementCharacter {0xFFFD};
  - for (auto const current: ranges::make_subrange(input, end))
  + while (input != end || utf8DecoderState_.expectedLength)
  {
  - unicode::ConvertResult const r = unicode::from_utf8(utf8DecoderState_, current);
  + unicode::ConvertResult const r = unicode::from_utf8(utf8DecoderState_, *input);
  +
  if (std::holds_alternative<unicode::Success>(r))
  processInput(std::get<unicode::Success>(r).value);
  else if (std::holds_alternative<unicode::Invalid>(r))
  processInput(ReplacementCharacter);
  +
  + ++input;
  + }
  }
  + while (input != end);
  }
  // {{{ dot
  