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

Method GetCharPosInLine

internal/buffer/cursor.go:102–105  ·  view source on GitHub ↗

GetCharPosInLine gets the char position of a visual x y coordinate (this is necessary because tabs are 1 char but 4 visual spaces)

(b []byte, visualPos int)

Source from the content-addressed store, hash-verified

100// coordinate (this is necessary because tabs are 1 char but
101// 4 visual spaces)
102func (c *Cursor) GetCharPosInLine(b []byte, visualPos int) int {
103 tabsize := int(c.buf.Settings["tabsize"].(float64))
104 return util.GetCharPosInLine(b, visualPos, tabsize)
105}
106
107// Start moves the cursor to the start of the line it is on
108func (c *Cursor) Start() {

Callers 3

SpawnMultiCursorUpNMethod · 0.95
UpNMethod · 0.95
LocFromVisualMethod · 0.80

Calls 1

GetCharPosInLineFunction · 0.92

Tested by

no test coverage detected