From 0a521241025d22d060b62cabe145bd9768b5da16 Mon Sep 17 00:00:00 2001 From: Daniel Bridges Date: Sat, 3 Aug 2019 21:09:13 -0700 Subject: Allow cc/bcc command to receive no arguments --- widgets/compose.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'widgets/compose.go') 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. -- cgit 1.4.1-2-gfad0 c31d1d3a3dbe4fd7ddb2e2f43a8ba229a33558da'>tree commit diff stats
path: root/subx.gedit
blob: 45ef133771a4c32fa017d6d8035337aaf8fb45df (plain) (blame)
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