Documentation ¶
Index ¶
- type LineNumber
- func (l LineNumber) AsOneBased() int
- func (l LineNumber) AsZeroBased() int
- func (l LineNumber) CountLinesTo(next LineNumber) int
- func (l LineNumber) Format() string
- func (l LineNumber) IsAfter(other LineNumber) bool
- func (l LineNumber) IsBefore(other LineNumber) bool
- func (l LineNumber) IsZero() bool
- func (l LineNumber) NonWrappingAdd(offset int) LineNumber
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 (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
Click to show internal directories.
Click to hide internal directories.