fun selectLinesWhile()

in src/main/kotlin/com/github/mkartashev/hserr/miner/text/Text.kt [221:233]


        fun selectLinesWhile(p: (String) -> Boolean): TextRange {
            var lastGoodLine = this
            var currentLine = this
            while (currentLine.isValid() && !currentLine.isAtEnd()) {
                val str = currentLine.selectUpToEOL()
                if (!p(str.toString())) break
                lastGoodLine = currentLine
                currentLine = currentLine.moveToNextLine()
            }

            lastGoodLine = lastGoodLine.moveToLineEnd()
            return if (lastGoodLine != this) selectUpTo(lastGoodLine) else TextRange.of(pastEnd, pastEnd)
        }