summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--config/config.go9
-rw-r--r--lib/ui/textinput.go2
-rw-r--r--widgets/account-wizard.go7
-rw-r--r--widgets/aerc.go6
4 files changed, 12 insertions, 12 deletions
diff --git a/config/config.go b/config/config.go
index c6136cf..1019297 100644
--- a/config/config.go
+++ b/config/config.go
@@ -100,7 +100,8 @@ func mapName(raw string) string {
 func loadAccountConfig(path string) ([]AccountConfig, error) {
 	file, err := ini.Load(path)
 	if err != nil {
-		return nil, err
+		// No config triggers account configuration wizard
+		return nil, nil
 	}
 	file.NameMapper = mapName
 
@@ -153,10 +154,6 @@ func loadAccountConfig(path string) ([]AccountConfig, error) {
 
 		accounts = append(accounts, account)
 	}
-	if len(accounts) == 0 {
-		err = errors.New("No accounts configured in accounts.conf")
-		return nil, err
-	}
 	return accounts, nil
 }
 
@@ -359,7 +356,7 @@ func LoadConfig(root *string) (*AercConfig, error) {
 func checkConfigPerms(filename string) error {
 	info, err := os.Stat(filename)
 	if err != nil {
-		return err
+		return nil // disregard absent files
 	}
 	perms := info.Mode().Perm()
 	goPerms := perms >> 3
diff --git a/lib/ui/textinput.go b/lib/ui/textinput.go
index ce443c3..3e7c12f 100644
--- a/lib/ui/textinput.go
+++ b/lib/ui/textinput.go
@@ -66,7 +66,7 @@ func (ti *TextInput) Draw(ctx *Context) {
 		ctx.Printf(0, 0, tcell.StyleDefault, "%s%s", ti.prompt, string(ti.text))
 	}
 	cells := runewidth.StringWidth(string(ti.text[:ti.index]) + ti.prompt)
-	if cells != ti.cells && ti.focus {
+	if ti.focus {
 		ctx.SetCursor(cells, 0)
 	}
 }
diff --git a/widgets/account-wizard.go b/widgets/account-wizard.go
index aa68ed7..6cd541e 100644
--- a/widgets/account-wizard.go
+++ b/widgets/account-wizard.go
@@ -356,8 +356,8 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
 			"To add another account in the future, run ':new-account'."))
 	selecter = newSelecter([]string{
 		"Previous",
-		"Finish",
 		"Finish & open tutorial",
+		"Finish",
 	}, 1).OnChoose(func(option string) {
 		switch option {
 		case "Previous":
@@ -436,11 +436,8 @@ func (wizard *AccountWizard) finish(tutorial bool) {
 	}
 
 	file, err := ini.Load(accountsConf)
-	if err == os.ErrNotExist {
+	if err != nil {
 		file = ini.Empty()
-	} else if err != nil {
-		wizard.errorFor(nil, err)
-		return
 	}
 
 	var sec *ini.Section
diff --git a/widgets/aerc.go b/widgets/aerc.go
index 484fd88..3c6566d 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -62,6 +62,12 @@ func NewAerc(conf *config.AercConfig, logger *log.Logger,
 		tabs.Add(view, acct.Name)
 	}
 
+	if len(conf.Accounts) == 0 {
+		wizard := NewAccountWizard(aerc.Config(), aerc)
+		wizard.Focus(true)
+		aerc.NewTab(wizard, "New account")
+	}
+
 	return aerc
 }
 
/span>__? Can't think of another word. container keyboard [ index:number data:address:array:character ] recipe new-fake-keyboard [ default-space:address:array:location <- new location:type, 30:literal result:address:keyboard <- new keyboard:type buf:address:address:array:character <- get-address result:address:keyboard/deref, data:offset #? $start-tracing #? 1 buf:address:address:array:character/deref <- next-ingredient #? $stop-tracing #? 1 idx:address:number <- get-address result:address:keyboard/deref, index:offset idx:address:number/deref <- copy 0:literal reply result:address:keyboard ] recipe read-key [ default-space:address:array:location <- new location:type, 30:literal x:address:keyboard <- next-ingredient { break-unless x:address:keyboard idx:address:number <- get-address x:address:keyboard/deref, index:offset buf:address:array:character <- get x:address:keyboard/deref, data:offset max:number <- length buf:address:array:character/deref { done?:boolean <- greater-or-equal idx:address:number/deref, max:number break-unless done?:boolean reply 0:literal/eof, 1:literal/found, x:address:keyboard/same-as-ingredient:0 } c:character <- index buf:address:array:character/deref, idx:address:number/deref idx:address:number/deref <- add idx:address:number/deref, 1:literal reply c:character, 1:literal/found, x:address:keyboard/same-as-ingredient:0 } # real keyboard input is infrequent; avoid polling it too much switch c:character, found?:boolean <- read-key-from-keyboard reply c:character, found?:boolean, x:address:keyboard/same-as-ingredient:0 ] recipe wait-for-key [ default-space:address:array:location <- new location:type, 30:literal x:address:keyboard <- next-ingredient { break-unless x:address:keyboard # on fake keyboards 'wait-for-key' behaves just like 'read-key' c:character, found?:boolean, x:address:keyboard <- read-key x:address:keyboard reply c:character, x:address:keyboard/same-as-ingredient:0 } c:character <- wait-for-key-from-keyboard reply c:character, x:address:keyboard/same-as-ingredient:0 ] recipe send-keys-to-channel [ default-space:address:array:location <- new location:type, 30:literal keyboard:address <- next-ingredient chan:address:channel <- next-ingredient screen:address <- next-ingredient { c:character, found?:boolean, keyboard:address <- read-key keyboard:address loop-unless found?:boolean #? print-integer screen:address, c:character #? 1 print-character screen:address, c:character chan:address:channel <- write chan:address:channel, c:character # todo: eof loop } ] e4ac3c9e ^
805d58c6 ^
204dae92 ^

e4ac3c9e ^
805d58c6 ^
204dae92 ^

5fe060d5 ^
805d58c6 ^

e4ac3c9e ^
805d58c6 ^



5fe060d5 ^
805d58c6 ^
204dae92 ^
4a48bedc ^
805d58c6 ^


5fe060d5 ^
805d58c6 ^

e4ac3c9e ^
805d58c6 ^




204dae92 ^




201458e3 ^
5fe060d5 ^
204dae92 ^
805d58c6 ^
e4ac3c9e ^
805d58c6 ^
204dae92 ^

805d58c6 ^
204dae92 ^
805d58c6 ^
204dae92 ^

76755b28 ^


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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217