mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-26 17:00:21 +09:00
Merge
This commit is contained in:
@@ -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":
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user