in src/main/kotlin/org/jetbrains/qodana/utils.kt [10:27]
fun lineColToOffset(text: CharSequence, line: Int, col: Int): Int {
var curLine = 0
var offset = 0
while (line != curLine) {
if (offset == text.length) return -1
val c = text[offset]
if (c == '\n') {
curLine++
} else if (c == '\r') {
curLine++
if (offset < text.length - 1 && text[offset + 1] == '\n') {
offset++
}
}
offset++
}
return offset + col
}