Merge pull request #998 from JoshuaRLi/select-line-action

Implemented SelectLine as an Action
This commit is contained in:
Zachary Yedidia
2018-01-17 17:25:37 -05:00
committed by GitHub
3 changed files with 16 additions and 0 deletions

View 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) {

View 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,

View File

@@ -156,6 +156,7 @@ MoveLinesUp
MoveLinesDown
DeleteWordRight
DeleteWordLeft
SelectLine
SelectToStartOfLine
SelectToEndOfLine
InsertNewline