computil

package
v0.0.0-...-486954f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindLongestCommonPrefix

func FindLongestCommonPrefix(first, last string, caseSensitive bool) string

FindLongestCommonPrefix returns the longest common prefix between the two arguments.

func FindWord

func FindWord(v [][]rune, line, col int) (word string, wordStart, wordEnd int)

FindWord is meant for use as a helper when implementing AutoComplete callbacks for the Model.AutoComplete field. Given AutoComplete's callback arguments, it searches and returns the start of the word that the cursor is currently on (as defined by the earliest character from the cursor that's not a whitespace) on the same line.

NB: it does not cross line boundaries. The length in runes of the prefix from the cursor to the beginning of the word is guaranteed to be col-wordStart.

func Flatten

func Flatten(v [][]rune, line, col int) (string, int)

Flatten converts a 2D rune representation of a completion context with a 2D cursor to a linear string and a 1D cursor.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL