| 4633 | } |
| 4634 | |
| 4635 | static Int64 getLineSpaces( TextDocument& doc, int line, int dir, int indentSize ) { |
| 4636 | if ( line < 0 || line >= (int)doc.linesCount() ) |
| 4637 | return -1; |
| 4638 | const auto& text = doc.line( line ).getText(); |
| 4639 | if ( text.size() <= 1 ) |
| 4640 | return -1; |
| 4641 | auto s = text.find_first_not_of( " \t\n" ); |
| 4642 | if ( s == std::string::npos ) |
| 4643 | return -getLineSpaces( doc, line + dir, dir, indentSize ); |
| 4644 | int n = 0; |
| 4645 | for ( size_t i = 0; i < s; ++i ) |
| 4646 | n += text[i] == ' ' ? 1 : indentSize; |
| 4647 | return n; |
| 4648 | } |
| 4649 | |
| 4650 | static Int64 getLineIndentGuideSpaces( TextDocument& doc, int line, int indentSize ) { |
| 4651 | if ( doc.line( line ).getText().find_first_not_of( " \t\n" ) == std::string::npos ) |
no test coverage detected