mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Add codePointBefore to idea-flex-kotlin.skeleton
Merge-request: FLEET-MR-6833 Merged-by: Boris Krylov <Boris.Krylov@jetbrains.com> GitOrigin-RevId: 0bab640f1e1d5a44f4df277db9c99e0ca371ee63
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c6335b5ae9
commit
35bcf69e0a
@@ -201,6 +201,17 @@ companion object {
|
||||
|
||||
private fun charCount(codePoint: Int): Int = if (codePoint < 0x10000) 1 else 2
|
||||
|
||||
private fun Char.Companion.codePointBefore(seq: CharSequence, index: Int): Int {
|
||||
var i = index - 1
|
||||
val c2 = seq[i];
|
||||
if (c2.isLowSurrogate() && index > 0) {
|
||||
val c1 = seq[i - 1];
|
||||
if (c1.isHighSurrogate()) {
|
||||
return Char.toCodePoint(c1, c2);
|
||||
}
|
||||
}
|
||||
return c2.code
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an error that occurred while scanning.
|
||||
|
||||
Reference in New Issue
Block a user