| 7952 | } |
| 7953 | |
| 7954 | std::string AnsiSkippingString::substring( const_iterator begin, |
| 7955 | const_iterator end ) const { |
| 7956 | // There's one caveat here to an otherwise simple substring: when |
| 7957 | // making a begin iterator we might have skipped ansi sequences at |
| 7958 | // the start. If `begin` here is a begin iterator, skipped over |
| 7959 | // initial ansi sequences, we'll use the true beginning of the |
| 7960 | // string. Lastly: We need to transform any chars we replaced with |
| 7961 | // 0xff back to 'm' |
| 7962 | auto str = std::string( begin == this->begin() ? m_string.begin() |
| 7963 | : begin.m_it, |
| 7964 | end.m_it ); |
| 7965 | std::transform( str.begin(), str.end(), str.begin(), []( char c ) { |
| 7966 | return c == AnsiSkippingString::sentinel ? 'm' : c; |
| 7967 | } ); |
| 7968 | return str; |
| 7969 | } |
| 7970 | |
| 7971 | void AnsiSkippingString::const_iterator::tryParseAnsiEscapes() { |
| 7972 | // check if we've landed on an ansi sequence, and if so read through |
no test coverage detected