Commit Graph

39 Commits

Author SHA1 Message Date
Moritz Poldrack 978d35d356 lint: homogenize operations and minor fixes (gocritic)
Apply GoDoc comment policy (comments for humans should have a space
after the //; machine-readable comments shouldn't)

Use strings.ReplaceAll instead of strings.Replace when appropriate

Remove if/else chains by replacing them with switches

Use short assignment/increment notation

Replace single case switches with if statements

Combine else and if when appropriate

Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-08-04 21:58:01 +02:00
Moritz Poldrack c882cf9960 lint: removed unused code (deadcode, structcheck, unused)
Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-08-04 21:58:00 +02:00
Moritz Poldrack 5ca6022d00 lint: ensure errors are at least logged (errcheck)
Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-08-04 21:57:57 +02:00
Moritz Poldrack ef599aa8fc lint: simplify code (gosimple)
Replaces infinite for loops containing a select on a channel with a
single case with a range over the channel.

Removes redundant assignments to blank identifiers.

Remove unnecessary guard clause around delete().

Remove `if condition { return true } return false` with return condition

Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-08-04 21:57:52 +02:00
Moritz Poldrack aaf0a0c656 lint: apply new formatting rules
Run `make fmt`.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-08-01 10:44:52 +02:00
Stas Rudakou ca90343850 outgoing-cred-cmd: delay execution until an email needs to be sent
This can be useful in cases when:

1. outgoing-cred-cmd requires a user action or confirmation (e.g. when
   using pass with a Yubikey or similar smart card that requires a user
   to enter a pin or touch the device when decrypting the password)

2. A user starts aerc frequently, but not all the sessions end up with
   sending emails

3. So the user only wants to execute outgoing-cred-cmd when the password
   is really used, so the user doesn't have to enter pin or touch their
   Yubikey each time aerc starts

Signed-off-by: Stas Rudakou <stas@garage22.net>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-07-31 19:53:13 +02:00
Robin Jarry cd19995557 logging: use level-based logger functions
Do not pass logger objects around anymore. Shuffle some messages to make
them consistent with the new logging API. Avoid using %v when a more
specific verb exists for the argument types.

The loggers are completely disabled (i.e. Sprintf is not even called)
by default. They are only enabled when redirecting stdout to a file.

Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
2022-07-23 22:52:15 +02:00
Tim Culverhouse d45c07eb6a uiconfig: use pointer references to uiConfig
This patch changes references to uiConfig in function signatures and
structs to be pointers.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-07-03 21:32:18 +02:00
Moritz Poldrack d66930749a logging: fix race condition in startup
If a panic occurs in one of the workers, it can happen after the UI was
initialised, but before the cleanup function has been registered. With
this the start of the worker loops is deferred until the cleanup routine
was registered.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
2022-03-24 12:37:53 +01:00
Moritz Poldrack e30bd324a3 go vet: composite literal uses unkeyed fields
This commit fixes all occurrences of the abovementioned lint-error in
the codebase.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-18 13:33:16 +01:00
Robin Jarry 0d645bcebd go.mod: change base git url
I'm not sure what are the implications but it seems required.

Link: https://github.com/golang/go/issues/20883
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-05 10:21:45 +01:00
Robin Jarry fc84b19bba view,compose: use border color to separate headers from body
When composing a message, there is an empty fill line between the
headers and the text editor. The line is printed with the default style
which may cause users to assume it is part of the editor.

Display the fill lines with the border color to avoid confusion.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-10-28 16:38:23 +02:00
Reto Brunner 8ea86cea41 Get rid of the aerc.PushError(" " + $string) idiom
The individual callers should not be responsible for padding
2021-01-30 14:04:23 +01:00
y0ast 03650474e2 update tcell to v2 and enable TrueColor support
Also update to the tcell v2 PaletteColor api, which should keep the chosen
theme of the user intact.

Note, that if $TRUECOLOR is defined and a truecolor given, aerc will now stop
clipping the value to one of the theme colors.
Generally this is desired behaviour though.
2020-12-18 07:23:22 +01:00
Reto Brunner 2d7a870725 show error if account view creation fails
This can happen for example if aerc is compiled without notmuch support but the
notmuch worker is requested.
Pushing a status message isn't good enough, as this gets overridden pretty
quickly if one has multiple accounts configured.
So we show a fullscreen error instead.
2020-08-10 08:00:34 +02:00
Kalyan Sriram 1023dd9588 Rename selecter to selector 2020-08-06 21:42:06 +02:00
Kalyan Sriram 905cb9dfd3 Implement style configuration.
Introduce the ability to configure stylesets, allowing customization of
aerc's look (color scheme, font weight, etc). Default styleset is
installed to /path/to/aerc/stylesets/default.
2020-08-06 21:42:06 +02:00
Reto Brunner 3d784c5d8c Revert "Implement style configuration."
This reverts commit 1ff687ca2b.
2020-07-30 23:22:32 +02:00
Reto Brunner 6ee7b1c3fd Revert "Rename selecter to selector"
This reverts commit 2c244222d5.
2020-07-30 23:22:16 +02:00
Kalyan Sriram 2c244222d5 Rename selecter to selector 2020-07-30 19:35:59 +02:00
Kalyan Sriram 1ff687ca2b Implement style configuration.
Introduce the ability to configure stylesets, allowing customization of
aerc's look (color scheme, font weight, etc). Default styleset is
installed to /path/to/aerc/stylesets/default.
2020-07-30 19:35:59 +02:00
Jeffas 543510f5c1 Make grid sizes dynamic
The grid used static sizes which meant that changing settings didn't
have an effect on elements of the ui, notably the sidebar width. This
patch makes the `Size` parameter of a cell a function which returns the
`int`, allowing for dynamic sizes.

A `Const` function is also included for ease of use for static sizes.
2020-06-09 08:48:47 +02:00
Drew DeVault caad1b2c06 Revert "Add Style configuration"
This reverts commit 0f78f06610.
2020-05-28 10:32:42 -04:00
Drew DeVault 76a91813d8 Revert "Remove duration from the status methods"
This reverts commit f06d683688.
2020-05-28 10:32:32 -04:00
Reto Brunner f06d683688 Remove duration from the status methods
We always set 10 seconds anyhow, might as well do that without repeating ourselfs.
2020-05-27 08:11:40 +02:00
Reto Brunner 0f78f06610 Add Style configuration
The following functionalities are added to configure aerc ui styles.
- Read stylesets from file with very basic fnmatch wildcard matching
- Add default styleset
- Support different stylesets as part of UiConfig allowing contextual
  styles.
- Move widgets/ui elements to use the stylesets.
- Add configuration manual for the styleset
2020-05-27 07:57:10 +02:00
Drew DeVault 6f8ad91824 gofmt fixes 2020-04-24 12:59:40 -04:00
Ben Fiedler 7c89143c70 Use aerc.PushError where appropriate
Forgot an unused import, to save you the hassle here is v2.
2020-04-23 21:02:45 +02:00
Greg Anders 4bdef7d860 Add UI options to save/pipe messages with unsupported mimetypes
Adds a message indicating the user's ability to :save or :pipe a message
with an unsupported mimetype and also adds a selector widget (similar to
the tutorial).

The selector widget was previously defined in the account wizard module,
so this commit breaks it out into its own module to allow for re-use.

Further, modify the BeginExLine() function to take an argument that
pre-populates the command line, allowing functions to initiate an ex
command without executing it.

Closes #95.
2019-11-17 13:19:13 -05:00
Jeffas f6216bb621 Add Mouseable
This adds the Mouseable interface. When this is implemented for a
component that item can accept and process mouseevents.

At the top level when a mouse event is received it is passed to the
grid's handler and then it trickles down until it reaches a component
that can actually handle it, such as the tablist, dirlist or msglist.

A mouse event is passed so that components can handle other things such
as scrolling with the mousewheel. The components themselves then perform
the necessary actions.

Clicking emails in the messagelist opens them in a new tab.

Textinputs can be clicked to position the cursor inside them.

Mouseevents are not forwarded to the terminal at the moment.

Elements which do not handle mouse events are not required to implement
the Mouseable interface.
2019-09-11 11:41:34 -04:00
Jeffas 0b3aca4167 Add backtab to tutorial navigation
This allows users to use backtab (Shift+tab) to go back through the
fields in the tutorial, like C-K. This then mimics the other methods in
having a forward and backward variant.

Also documented this in the wizard help paragraph.
2019-07-11 19:38:12 -04:00
Daniel Lublin 61c94e54cd account-wizard: look up imap and smtp server by SRV records (#100) 2019-06-25 10:31:28 -04:00
Noah Loomans d1654def19 account-wizard: automatically replace imap.* with smtp.*
Many email providers use the imap sub-domain for imap and the smtp
sub-domain for smtp. FastMail is an example of this[1]. This is a small
quality-of-life improvement which automatically replaces imap.* with
smtp.* when going from the imap screen to the smtp screen in the wizard

[1]: https://www.fastmail.com/help/technical/servernamesandports.html
2019-06-18 19:40:02 -04:00
JanUlrich 0771eaf24c Introduce :new-account -t
Adding the [-t] temporary flag to the new-account command
- when using -t a newly created account will not be stored into the
accounts.conf

Issue #134
2019-06-05 09:32:43 -04:00
Drew DeVault 9b19e3ad05 Show account wizard if no accounts configured 2019-05-22 11:35:55 -04:00
Drew DeVault 58bc15b472 Implement opening tutorial after account wizard 2019-05-22 11:13:55 -04:00
Drew DeVault 937b33c850 Write new accounts to config and open tab 2019-05-22 10:40:08 -04:00
Drew DeVault 4d6e665204 Remove excess padding from incoming config page 2019-05-21 17:00:35 -04:00
Drew DeVault 6811143925 New account wizard, part one 2019-05-21 16:53:50 -04:00