about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--commands/compose/cc-bcc.go7
-rw-r--r--doc/aerc.1.scd2
-rw-r--r--widgets/compose.go17
3 files changed, 21 insertions, 5 deletions
diff --git a/commands/compose/cc-bcc.go b/commands/compose/cc-bcc.go
index 864bb8e..db5f5b6 100644
--- a/commands/compose/cc-bcc.go
+++ b/commands/compose/cc-bcc.go
@@ -1,7 +1,6 @@
 package compose
 
 import (
-	"fmt"
 	"strings"
 
 	"git.sr.ht/~sircmpwn/aerc/widgets"
@@ -22,10 +21,10 @@ func (_ CC) Complete(aerc *widgets.Aerc, args []string) []string {
 }
 
 func (_ CC) Execute(aerc *widgets.Aerc, args []string) error {
-	if len(args) < 2 {
-		return fmt.Errorf("Usage: %s <addresses>", args[0])
+	var addrs string
+	if len(args) > 1 {
+		addrs = strings.Join(args[1:], " ")
 	}
-	addrs := strings.Join(args[1:], " ")
 	composer, _ := aerc.SelectedTab().(*widgets.Composer)
 
 	switch args[0] {
diff --git a/doc/aerc.1.scd b/doc/aerc.1.scd
index 725549e..10e6485 100644
--- a/doc/aerc.1.scd
+++ b/doc/aerc.1.scd
@@ -216,7 +216,7 @@ message list, the message in the message viewer, etc).
 	Detaches the file with the given path from the composed email. If no path is
 	specified, detaches the first attachment instead.
 
-*cc* <addresses>, *bcc* <addresses>
+*cc* [addresses], *bcc* [addresses]
 	Sets the Cc or Bcc header to the given addresses. If an editor for the header
 	is not currently visible in the compose window, a new one will be added.
 
diff --git a/widgets/compose.go b/widgets/compose.go
index 936da14..c7e38b8 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -509,6 +509,17 @@ func (c *Composer) NextField() {
 	c.focusable[c.focused].Focus(true)
 }
 
+func (c *Composer) FocusEditor(editor *headerEditor) {
+	c.focusable[c.focused].Focus(false)
+	for i, e := range c.focusable {
+		if e == editor {
+			c.focused = i
+			break
+		}
+	}
+	c.focusable[c.focused].Focus(true)
+}
+
 // AddEditor appends a new header editor to the compose window.
 func (c *Composer) AddEditor(header string, value string, appendHeader bool) {
 	if _, ok := c.editors[header]; ok {
@@ -517,6 +528,9 @@ func (c *Composer) AddEditor(header string, value string, appendHeader bool) {
 			value = strings.TrimSpace(header) + ", " + value
 		}
 		c.editors[header].input.Set(value)
+		if value == "" {
+			c.FocusEditor(c.editors[header])
+		}
 		return
 	}
 	e := newHeaderEditor(header, value)
@@ -529,6 +543,9 @@ func (c *Composer) AddEditor(header string, value string, appendHeader bool) {
 		c.focusable[len(c.focusable)-1],
 	)
 	c.updateGrid()
+	if value == "" {
+		c.FocusEditor(c.editors[header])
+	}
 }
 
 // updateGrid should be called when the underlying header layout is changed.
># # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import os.path import sys rangerpath = os.path.join(os.path.dirname(__file__), '..') if sys.path[1] != rangerpath: sys.path[1:1] = [rangerpath] from ranger.ext.human_readable import * # The version before 2010/06/24: import math UNITS = 'BKMGTP' MAX_EXPONENT = len(UNITS) - 1 def human_readable_old(byte, seperator=' '): if not byte: return '0' exponent = int(math.log(byte, 2) / 10) flt = round(float(byte) / (1 << (10 * exponent)), 2) if exponent > MAX_EXPONENT: return '>9000' # off scale if int(flt) == flt: return '%.0f%s%s' % (flt, seperator, UNITS[exponent]) else: return '%.2f%s%s' % (flt, seperator, UNITS[exponent]) class benchmark_human_readable(object): def bm_current(self, n): for i in range(n): human_readable((128 * i) % 2**50) def bm_old(self, n): for i in range(n): human_readable_old((128 * i) % 2**50) m> 2018-01-25 22:39:31 -0800 4199' href='/akkartik/mu/commit/html/083scenario_screen_test.mu.html?h=hlt&id=805d58c6aeeeba3e4989c0eed6781b3861e8fae0'>805d58c6 ^
204dae92 ^







b301e0c0 ^
204dae92 ^
b301e0c0 ^
204dae92 ^
b301e0c0 ^
204dae92 ^

805d58c6 ^


204dae92 ^

aac2775a ^




805d58c6 ^
b301e0c0 ^


aac2775a ^

805d58c6 ^

aac2775a ^

672e3e50 ^


a654e4ec ^
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
105
106
107