- if len(args) > 0 {
- // Option 1
- // We go through each file and load it
- for i := 0; i < len(args); i++ {
- if strings.HasPrefix(args[i], "+") {
- if strings.Contains(args[i], ":") {
- split := strings.Split(args[i], ":")
- *flagStartPos = split[0][1:] + "," + split[1]
- } else {
- *flagStartPos = args[i][1:] + ",0"
- }
+ btype := buffer.BTDefault
+ if !isatty.IsTerminal(os.Stdout.Fd()) {
+ btype = buffer.BTStdout
+ }
+
+ files := make([]string, 0, len(args))
+ flagStartPos := buffer.Loc{-1, -1}
+ flagr := regexp.MustCompile(`^\+(\d+)(?::(\d+))?$`)
+ for _, a := range args {
+ match := flagr.FindStringSubmatch(a)
+ if len(match) == 3 && match[2] != "" {
+ line, err := strconv.Atoi(match[1])
+ if err != nil {
+ screen.TermMessage(err)
+ continue
+ }
+ col, err := strconv.Atoi(match[2])
+ if err != nil {
+ screen.TermMessage(err)
+ continue
+ }
+ flagStartPos = buffer.Loc{col - 1, line - 1}
+ } else if len(match) == 3 && match[2] == "" {
+ line, err := strconv.Atoi(match[1])
+ if err != nil {
+ screen.TermMessage(err)