GetArg gets the most recent word (separated by ' ' only)
()
| 84 | |
| 85 | // GetArg gets the most recent word (separated by ' ' only) |
| 86 | func (b *Buffer) GetArg() (string, int) { |
| 87 | c := b.GetActiveCursor() |
| 88 | l := b.LineBytes(c.Y) |
| 89 | l = util.SliceStart(l, c.X) |
| 90 | |
| 91 | args := bytes.Split(l, []byte{' '}) |
| 92 | input := string(args[len(args)-1]) |
| 93 | argstart := 0 |
| 94 | for i, a := range args { |
| 95 | if i == len(args)-1 { |
| 96 | break |
| 97 | } |
| 98 | argstart += util.CharacterCount(a) + 1 |
| 99 | } |
| 100 | |
| 101 | return input, argstart |
| 102 | } |
| 103 | |
| 104 | // FileComplete autocompletes filenames |
| 105 | func FileComplete(b *Buffer) ([]string, []string) { |
no test coverage detected