mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 09:25:38 +00:00
widget: test and document seekPosition
This commit adds a test for the seekPosition helper, a function which can be used to move a combinedPos forward through a body of text until it approaches a position. Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
@@ -1093,6 +1093,8 @@ func (e *Editor) closestPosition(pos combinedPos) combinedPos {
|
||||
|
||||
// seekPosition seeks to the position closest to needle, starting at start and returns true.
|
||||
// If limit is non-zero, seekPosition stops seeks after limit runes and returns false.
|
||||
// Start must have all fields valid, and needle must have at least one of runes, lineCol,
|
||||
// or x+y valid. Start must be known to be before needle.
|
||||
func seekPosition(lines []text.Line, alignment text.Alignment, width int, start, needle combinedPos, limit int) (combinedPos, bool) {
|
||||
count := 0
|
||||
// Advance until start is greater than or equal to needle.
|
||||
|
||||
Reference in New Issue
Block a user