MCPcopy
hub / github.com/micro-editor/micro / LocFromVisual

Method LocFromVisual

internal/display/tabwindow.go:31–47  ·  view source on GitHub ↗
(vloc buffer.Loc)

Source from the content-addressed store, hash-verified

29}
30
31func (w *TabWindow) LocFromVisual(vloc buffer.Loc) int {
32 x := -w.hscroll
33
34 for i, n := range w.Names {
35 x++
36 s := util.CharacterCountInString(n)
37 if vloc.Y == w.Y && vloc.X < x+s {
38 return i
39 }
40 x += s
41 x += 3
42 if x >= w.Width {
43 break
44 }
45 }
46 return -1
47}
48
49func (w *TabWindow) Scroll(amt int) {
50 w.hscroll += amt

Callers

nothing calls this directly

Calls 1

CharacterCountInStringFunction · 0.92

Tested by

no test coverage detected