This commit is contained in:
Zachary Yedidia
2016-04-04 14:03:38 -04:00
2 changed files with 19 additions and 2 deletions

View File

@@ -7,9 +7,25 @@ import (
// HandleCommand handles input from the user
func HandleCommand(input string, view *View) {
cmd := strings.Split(input, " ")[0]
inputCmd := strings.Split(input, " ")[0]
args := strings.Split(input, " ")[1:]
switch cmd {
commands := []string{"set", "quit", "save"}
i := 0
cmd := inputCmd
for _, c := range commands {
if strings.HasPrefix(c, inputCmd) {
i++
cmd = c
}
}
if i == 1 {
inputCmd = cmd
}
switch inputCmd {
case "set":
SetOption(view, args)
case "quit":

View File

@@ -217,6 +217,7 @@ func (v *View) Save() {
if err != nil {
messenger.Error(err.Error())
}
messenger.Message("Saved " + v.buf.path)
}
// Copy the selection to the system clipboard