aerc/config
Tim Culverhouse de24d2d590 config: fix setting of zero-value time.Duration config values
When using section.MapTo(struct) (go-ini), if the struct has a default
value for a time.Duration type, a zero-value in the config will not
overwrite the default. If the type is *time.Duration, it will be
overwritten properly. One consideration was to change all
time.Duration types to *time.Duration. This method was chosen for ease
of implementation.

For example, if you set dirlist-delay = 0s, the delay will be 200ms.
This can be observed by logging the value just after mapping the ui
section in config.go. A config value of 0.1ms will have a delay of
0.1ms.

Currently, aerc has 4 time.Duration config values:
1. DirlistDelay - default 200 ms
2. CompletionDelay - default 250 ms
3. CheckMail - default unset (0)
4. CheckMailTimeout - default 10 s

1, 2, and 4 have a non-zero default value and are subject to this bug.
Only 1 and 2 are fixed in this patch. Number 4 would not make sense to
have a 0 second timeout, therefore we can prevent the user from doing
this by keeping it as it is.

Another option could be to set these to 0 in config.go. The default
config (aerc.conf) has these keys in it with their default values.
Presumably, we don't need to set them again in config.go. If a user
deletes the config values out of aerc.conf, the UI will function but
with 0s delays.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Moritz Poldrack <moritz@poldrack.dev>
2022-06-22 11:36:47 +02:00
..
accounts.conf Copy sent emails to the Sent folder 2019-05-15 19:41:21 -04:00
aerc.conf msgviewer: open http links from messages 2022-06-14 22:12:48 +02:00
bindings.go binds: fix incorrect key names for c-] and c-[ 2022-04-25 11:22:12 +02:00
bindings_test.go bindings: support more modified keys 2021-10-28 16:22:28 +02:00
binds.conf binds: Open msgs in default Postpone folder in edit-mode 2022-06-22 11:36:46 +02:00
config.go config: fix setting of zero-value time.Duration config values 2022-06-22 11:36:47 +02:00
default_styleset fix aerc-stylesets(7) typos 2020-12-13 10:30:56 +01:00
style.go style: add style config options for dirlist_unread and dirlist_recent 2022-04-27 09:46:06 +02:00
triggers.go index: add this-week-time-format 2021-11-06 17:34:20 +01:00