linenumbers

package
v1.28.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: BSD-2-Clause-Views Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LineNumber

type LineNumber struct {
	// contains filtered or unexported fields
}

func LineNumberFromLength

func LineNumberFromLength(length int) *LineNumber

Set the line number to the last line of a file with the given number of lines in it. Or nil if the line count is 0.

func LineNumberFromOneBased

func LineNumberFromOneBased(oneBased int) LineNumber

func LineNumberFromZeroBased

func LineNumberFromZeroBased(zeroBased int) LineNumber

func LineNumberMax

func LineNumberMax() LineNumber

The highest possible line number

func (LineNumber) AsOneBased

func (l LineNumber) AsOneBased() int

func (LineNumber) AsZeroBased

func (l LineNumber) AsZeroBased() int

FIXME: Maybe drop this in favor of some array access method(s)?

func (LineNumber) CountLinesTo

func (l LineNumber) CountLinesTo(next LineNumber) int

If both lines are the same this method will return 1.

func (LineNumber) Format

func (l LineNumber) Format() string

Formats a number into a string with _ between each three-group of digits, for numbers >= 10_000.

Regarding the >= 10_000 exception: https://en.wikipedia.org/wiki/Decimal_separator#Exceptions_to_digit_grouping

func (LineNumber) IsAfter

func (l LineNumber) IsAfter(other LineNumber) bool

func (LineNumber) IsBefore

func (l LineNumber) IsBefore(other LineNumber) bool

func (LineNumber) IsZero

func (l LineNumber) IsZero() bool

Is this the lowest possible line number?

func (LineNumber) NonWrappingAdd

func (l LineNumber) NonWrappingAdd(offset int) LineNumber

Jump to

Keyboard shortcuts

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