summary refs log tree commit diff stats
path: root/commands/ct.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/ct.go')
-rw-r--r--commands/ct.go16
1 files changed, 9 insertions, 7 deletions
diff --git a/commands/ct.go b/commands/ct.go
index 3cae0bd..8b6e8a8 100644
--- a/commands/ct.go
+++ b/commands/ct.go
@@ -23,9 +23,10 @@ func (ChangeTab) Complete(aerc *widgets.Aerc, args []string) []string {
 	if len(args) == 0 {
 		return aerc.TabNames()
 	}
+	joinedArgs := strings.Join(args, " ")
 	out := make([]string, 0)
 	for _, tab := range aerc.TabNames() {
-		if strings.HasPrefix(tab, args[0]) {
+		if strings.HasPrefix(tab, joinedArgs) {
 			out = append(out, tab)
 		}
 	}
@@ -33,22 +34,23 @@ func (ChangeTab) Complete(aerc *widgets.Aerc, args []string) []string {
 }
 
 func (ChangeTab) Execute(aerc *widgets.Aerc, args []string) error {
-	if len(args) != 2 {
+	if len(args) == 1 {
 		return fmt.Errorf("Usage: %s <tab>", args[0])
 	}
-	if args[1] == "-" {
+	joinedArgs := strings.Join(args[1:], " ")
+	if joinedArgs == "-" {
 		ok := aerc.SelectPreviousTab()
 		if !ok {
 			return errors.New("No previous tab to return to")
 		}
 	} else {
-		n, err := strconv.Atoi(args[1])
+		n, err := strconv.Atoi(joinedArgs)
 		if err == nil {
-			if strings.HasPrefix(args[1], "+") {
+			if strings.HasPrefix(joinedArgs, "+") {
 				for ; n > 0; n-- {
 					aerc.NextTab()
 				}
-			} else if strings.HasPrefix(args[1], "-") {
+			} else if strings.HasPrefix(joinedArgs, "-") {
 				for ; n < 0; n++ {
 					aerc.PrevTab()
 				}
@@ -60,7 +62,7 @@ func (ChangeTab) Execute(aerc *widgets.Aerc, args []string) error {
 				}
 			}
 		} else {
-			ok := aerc.SelectTab(args[1])
+			ok := aerc.SelectTab(joinedArgs)
 			if !ok {
 				return errors.New("No tab with that name")
 			}
Kartik Agaram <vc@akkartik.com> 2018-12-29 15:27:18 -0800 committer Kartik Agaram <vc@akkartik.com> 2018-12-29 15:27:18 -0800 4890 - new html renderings' href='/akkartik/mu/commit/html/subx/examples/ex12.subx.html?h=main&id=ac07e589b3e912c704c2011d543f18b16712ff15'>ac07e589 ^
60338448 ^
695f9bf8 ^
60338448 ^
e0610e39 ^
ac07e589 ^
5a2cb154 ^















695f9bf8 ^
5a2cb154 ^















c9bda4d1 ^
5a2cb154 ^
14a38052 ^
c56d803c ^

60338448 ^
ee0e67b9 ^

c56d803c ^
5a2cb154 ^
a0d3cac4 ^
14a38052 ^


5a2cb154 ^
695f9bf8 ^
a0d3cac4 ^











695f9bf8 ^
a0d3cac4 ^















5a2cb154 ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104