From 1c49532447cbce66d11eb4ccc25dab235b585187 Mon Sep 17 00:00:00 2001 From: Chris Waldon Date: Tue, 10 Jan 2023 12:17:37 -0500 Subject: [PATCH] widget: update ByteOffset method docs Signed-off-by: Chris Waldon --- widget/text.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/widget/text.go b/widget/text.go index f8ee0eb2..743b7a38 100644 --- a/widget/text.go +++ b/widget/text.go @@ -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)) }