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

Method DeleteSelection

internal/buffer/cursor.go:176–186  ·  view source on GitHub ↗

DeleteSelection deletes the currently selected text

()

Source from the content-addressed store, hash-verified

174
175// DeleteSelection deletes the currently selected text
176func (c *Cursor) DeleteSelection() {
177 if c.CurSelection[0].GreaterThan(c.CurSelection[1]) {
178 c.buf.Remove(c.CurSelection[1], c.CurSelection[0])
179 c.Loc = c.CurSelection[1]
180 } else if !c.HasSelection() {
181 return
182 } else {
183 c.buf.Remove(c.CurSelection[0], c.CurSelection[1])
184 c.Loc = c.CurSelection[0]
185 }
186}
187
188// Deselect closes the cursor's current selection
189// Start indicates whether the cursor should be placed

Callers 15

checkFunction · 0.95
benchEditFunction · 0.95
DoRuneInsertMethod · 0.80
InsertNewlineMethod · 0.80
BackspaceMethod · 0.80
DeleteWordRightMethod · 0.80
DeleteWordLeftMethod · 0.80
DeleteSubWordRightMethod · 0.80
DeleteSubWordLeftMethod · 0.80
DeleteMethod · 0.80
CutMethod · 0.80
CutLineMethod · 0.80

Calls 3

HasSelectionMethod · 0.95
GreaterThanMethod · 0.45
RemoveMethod · 0.45

Tested by 2

checkFunction · 0.76
benchEditFunction · 0.76