Add DeleteLine binding

Ref #135
This commit is contained in:
Zachary Yedidia
2016-06-07 21:47:34 -04:00
parent 3deee51537
commit bd0fa7b6c2

View File

@@ -54,6 +54,7 @@ var bindingActions = map[string]func(*View) bool{
"Cut": (*View).Cut,
"CutLine": (*View).CutLine,
"DuplicateLine": (*View).DuplicateLine,
"DeleteLine": (*View).DeleteLine,
"Paste": (*View).Paste,
"SelectAll": (*View).SelectAll,
"OpenFile": (*View).OpenFile,
@@ -859,6 +860,18 @@ func (v *View) DuplicateLine() bool {
return true
}
// DeleteLine deletes the current line
func (v *View) DeleteLine() bool {
v.Cursor.SelectLine()
if !v.Cursor.HasSelection() {
return false
}
v.Cursor.DeleteSelection()
v.Cursor.ResetSelection()
messenger.Message("Deleted line")
return true
}
// Paste whatever is in the system clipboard into the buffer
// Delete and paste if the user has a selection
func (v *View) Paste() bool {