DeleteSelection deletes the currently selected text
()
| 174 | |
| 175 | // DeleteSelection deletes the currently selected text |
| 176 | func (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 |