widget: update ByteOffset method docs

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
Chris Waldon
2023-01-10 12:17:37 -05:00
committed by Elias Naur
parent 044390c9df
commit 1c49532447
+2 -3
View File
@@ -326,9 +326,8 @@ func (e *textView) CaretInfo() (pos image.Point, ascent, descent int) {
return
}
// ByteOffset returns the offset of the start byte of the rune nearest
// to the rune at the given offset. If the given offset is before or
// after the text, it will be clamped to the first or last rune.
// ByteOffset returns the start byte of the rune at the given
// rune offset, clamped to the size of the text.
func (e *textView) ByteOffset(runeOffset int) int64 {
return int64(e.runeOffset(e.closestToRune(runeOffset).runes))
}