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

Method AddLineToSelection

internal/buffer/cursor.go:229–244  ·  view source on GitHub ↗

AddLineToSelection adds the current line to the selection

()

Source from the content-addressed store, hash-verified

227
228// AddLineToSelection adds the current line to the selection
229func (c *Cursor) AddLineToSelection() {
230 if c.Loc.LessThan(c.OrigSelection[0]) {
231 c.Start()
232 c.SetSelectionStart(c.Loc)
233 c.SetSelectionEnd(c.OrigSelection[1])
234 }
235 if c.Loc.GreaterThan(c.OrigSelection[1]) {
236 c.End()
237 c.SetSelectionEnd(c.Loc.Move(1, c.buf))
238 c.SetSelectionStart(c.OrigSelection[0])
239 }
240
241 if c.Loc.LessThan(c.OrigSelection[1]) && c.Loc.GreaterThan(c.OrigSelection[0]) {
242 c.CurSelection = c.OrigSelection
243 }
244}
245
246// UpN moves the cursor up N lines (if possible)
247func (c *Cursor) UpN(amount int) {

Callers 1

MouseDragMethod · 0.80

Calls 7

StartMethod · 0.95
SetSelectionStartMethod · 0.95
SetSelectionEndMethod · 0.95
EndMethod · 0.95
MoveMethod · 0.80
LessThanMethod · 0.45
GreaterThanMethod · 0.45

Tested by

no test coverage detected