]> git.lizzy.rs Git - micro.git/commitdiff
implemented select line as an Action
authorJoshua Li <joshua.r.li.98@gmail.com>
Tue, 16 Jan 2018 22:27:15 +0000 (17:27 -0500)
committerJoshua Li <joshua.r.li.98@gmail.com>
Tue, 16 Jan 2018 22:27:15 +0000 (17:27 -0500)
cmd/micro/actions.go
cmd/micro/bindings.go
runtime/help/keybindings.md

index 85ce1bb8169def98ebb78303235b5868ec4aa179..b05abdfb46cef1196d50b43d223b10eec22a3fd6 100644 (file)
@@ -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) {
index c14ce7240961550f3b3d53fe7a10fb06309bb820..f70e58230d81bf63836afff12fd8f3e517cef701 100644 (file)
@@ -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,
index 0a76a8a4355d0ec09ca3ff1c76dd347dac926cf4..dfee40b623757ed65c8ac105e214348026ace54d 100644 (file)
@@ -156,6 +156,7 @@ MoveLinesUp
 MoveLinesDown
 DeleteWordRight
 DeleteWordLeft
+SelectLine
 SelectToStartOfLine
 SelectToEndOfLine
 InsertNewline