From d7ba2f600ed57196cdcffbf79e6637252528da34 Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Tue, 16 Jan 2018 17:27:15 -0500 Subject: [PATCH] implemented select line as an Action --- cmd/micro/actions.go | 14 ++++++++++++++ cmd/micro/bindings.go | 1 + runtime/help/keybindings.md | 1 + 3 files changed, 16 insertions(+) diff --git a/cmd/micro/actions.go b/cmd/micro/actions.go index 85ce1bb8..b05abdfb 100644 --- a/cmd/micro/actions.go +++ b/cmd/micro/actions.go @@ -458,6 +458,20 @@ func (v *View) EndOfLine(usePlugin bool) bool { return true } +// SelectLine selects the entire current line +func (v *View) SelectLine(usePlugin bool) bool { + if usePlugin && !PreActionCall("SelectLine", v) { + return false + } + + v.Cursor.SelectLine() + + if usePlugin { + return PostActionCall("SelectLine", v) + } + return true +} + // SelectToStartOfLine selects to the start of the current line func (v *View) SelectToStartOfLine(usePlugin bool) bool { if usePlugin && !PreActionCall("SelectToStartOfLine", v) { diff --git a/cmd/micro/bindings.go b/cmd/micro/bindings.go index c14ce724..f70e5823 100644 --- a/cmd/micro/bindings.go +++ b/cmd/micro/bindings.go @@ -43,6 +43,7 @@ var bindingActions = map[string]func(*View, bool) bool{ "SelectWordLeft": (*View).SelectWordLeft, "DeleteWordRight": (*View).DeleteWordRight, "DeleteWordLeft": (*View).DeleteWordLeft, + "SelectLine": (*View).SelectLine, "SelectToStartOfLine": (*View).SelectToStartOfLine, "SelectToEndOfLine": (*View).SelectToEndOfLine, "ParagraphPrevious": (*View).ParagraphPrevious, diff --git a/runtime/help/keybindings.md b/runtime/help/keybindings.md index 0a76a8a4..dfee40b6 100644 --- a/runtime/help/keybindings.md +++ b/runtime/help/keybindings.md @@ -156,6 +156,7 @@ MoveLinesUp MoveLinesDown DeleteWordRight DeleteWordLeft +SelectLine SelectToStartOfLine SelectToEndOfLine InsertNewline