MCPcopy Create free account
hub / github.com/SolarLune/masterplan / IndexInLine

Method IndexInLine

gui.go:2679–2688  ·  view source on GitHub ↗
(index int)

Source from the content-addressed store, hash-verified

2677}
2678
2679func (label *Label) IndexInLine(index int) int {
2680 cp := index
2681 for _, line := range label.RendererResult.TextLines {
2682 if cp <= len(line)-1 {
2683 return cp
2684 }
2685 cp -= len(line)
2686 }
2687 return len(label.RendererResult.TextLines[len(label.RendererResult.TextLines)-1])
2688}
2689
2690func (label *Label) LineNumber(textIndex int) int {
2691 cp := textIndex

Callers 1

UpdateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected