MCPcopy Create free account
hub / github.com/ChaiScript/ChaiScript / calcLength

Method calcLength

unittests/catch.hpp:5316–5342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5314 }
5315
5316 void calcLength() {
5317 assert( m_stringIndex < m_column.m_strings.size() );
5318
5319 m_suffix = false;
5320 auto width = m_column.m_width-indent();
5321 m_end = m_pos;
5322 while( m_end < line().size() && line()[m_end] != '\n' )
5323 ++m_end;
5324
5325 if( m_end < m_pos + width ) {
5326 m_len = m_end - m_pos;
5327 }
5328 else {
5329 size_t len = width;
5330 while (len > 0 && !isBoundary(m_pos + len))
5331 --len;
5332 while (len > 0 && isWhitespace( line()[m_pos + len - 1] ))
5333 --len;
5334
5335 if (len > 0) {
5336 m_len = len;
5337 } else {
5338 m_suffix = true;
5339 m_len = width - 1;
5340 }
5341 }
5342 }
5343
5344 auto indent() const -> size_t {
5345 auto initial = m_pos == 0 && m_stringIndex == 0 ? m_column.m_initialIndent : std::string::npos;

Callers

nothing calls this directly

Calls 2

isWhitespaceFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected