2024-09-21 15:30:58 +02:00

20 lines
335 B
Go

package common
// LSPCharacterAsCursorPosition:
// @deprecated
func CursorToCharacterIndex(cursor uint32) uint32 {
return max(1, cursor) - 1
}
func DeprecatedImprovedCursorToIndex(
c CursorPosition,
line string,
offset uint32,
) uint32 {
if len(line) == 0 {
return 0
}
return min(uint32(len(line)-1), uint32(c)-offset+1)
}