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

Method IsStartOfText

internal/buffer/cursor.go:127–136  ·  view source on GitHub ↗

IsStartOfText returns whether the cursor is at the first non-whitespace rune of the line it is on

()

Source from the content-addressed store, hash-verified

125// IsStartOfText returns whether the cursor is at the first
126// non-whitespace rune of the line it is on
127func (c *Cursor) IsStartOfText() bool {
128 x := 0
129 for util.IsWhitespace(c.RuneUnder(x)) {
130 if x == util.CharacterCount(c.buf.LineBytes(c.Y)) {
131 break
132 }
133 x++
134 }
135 return c.X == x
136}
137
138// End moves the cursor to the end of the line it is on
139func (c *Cursor) End() {

Callers 2

StartOfTextToggleMethod · 0.80

Calls 4

RuneUnderMethod · 0.95
IsWhitespaceFunction · 0.92
CharacterCountFunction · 0.92
LineBytesMethod · 0.65

Tested by

no test coverage detected