MCPcopy Index your code
hub / github.com/micro-editor/micro / GetSelection

Method GetSelection

internal/buffer/cursor.go:204–212  ·  view source on GitHub ↗

GetSelection returns the cursor's selection

()

Source from the content-addressed store, hash-verified

202
203// GetSelection returns the cursor's selection
204func (c *Cursor) GetSelection() []byte {
205 if InBounds(c.CurSelection[0], c.buf) && InBounds(c.CurSelection[1], c.buf) {
206 if c.CurSelection[0].GreaterThan(c.CurSelection[1]) {
207 return c.buf.Substr(c.CurSelection[1], c.CurSelection[0])
208 }
209 return c.buf.Substr(c.CurSelection[0], c.CurSelection[1])
210 }
211 return []byte{}
212}
213
214// SelectLine selects the current line
215func (c *Cursor) SelectLine() {

Callers 8

CopySelectionMethod · 0.95
findMethod · 0.45
CutLineMethod · 0.45
DuplicateMethod · 0.45
SpawnMultiCursorMethod · 0.45
skipMultiCursorMethod · 0.45
TextFilterCmdMethod · 0.45
HandleEventMethod · 0.45

Calls 3

InBoundsFunction · 0.85
SubstrMethod · 0.80
GreaterThanMethod · 0.45

Tested by

no test coverage detected