| 1938 | } |
| 1939 | |
| 1940 | TextPosition TextDocument::nextSpaceBoundaryInLine( TextPosition position, std::size_t maxSeekChars, |
| 1941 | bool returnInvalidOnMaxSeek ) const { |
| 1942 | auto ch = getChar( position ); |
| 1943 | bool inWord = ch != ' '; |
| 1944 | String::StringBaseType nextChar = 0; |
| 1945 | Int64 seekChars = static_cast<Int64>( maxSeekChars ); |
| 1946 | do { |
| 1947 | TextPosition curPos = position; |
| 1948 | position = positionOffset( position, 1 ); |
| 1949 | if ( curPos == position ) |
| 1950 | break; |
| 1951 | if ( curPos.line() != position.line() ) { |
| 1952 | position = curPos; |
| 1953 | break; |
| 1954 | } |
| 1955 | nextChar = getChar( position ); |
| 1956 | } while ( ( ( inWord && nextChar != ' ' ) || ( !inWord && nextChar == ch ) ) && --seekChars ); |
| 1957 | return returnInvalidOnMaxSeek && seekChars == 0 ? TextPosition() : position; |
| 1958 | } |
| 1959 | |
| 1960 | TextPosition TextDocument::startOfWord( TextPosition position ) const { |
| 1961 | while ( true ) { |
no test coverage detected