Commit Graph

978 Commits

Author SHA1 Message Date
Robin Jarry 138977b2ce main: set xterm title
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-02 11:24:33 +01:00
Reto Brunner bc48628839 maildir: track the recent flag correctly
In the maildir worker we manually need to track the Recent flag in order for the
notification command etc to work.

Push that responsibility to the container, we must make sure to manually add the
flag though if one grabs the message info.
2021-11-01 13:30:45 +01:00
Robin Jarry 8d4c6e1adf go: update all dependencies
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-01 13:24:26 +01:00
Robin Jarry 36c9840f9b readme: update with fork info
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-10-30 22:07:32 +02:00
Robin Jarry 074b0a1bd8 view,list: fix crash when viewing incomplete imap messages
With IMAP, due to an unidentified reason, some messages to not have any
body accessible. When viewing them, aerc crashes:

  git.sr.ht/~sircmpwn/aerc/lib.usePGP
          lib/messageview.go:37
  git.sr.ht/~sircmpwn/aerc/lib.NewMessageStoreView
          lib/messageview.go:67
  git.sr.ht/~sircmpwn/aerc/commands/account.ViewMessage.Execute
          commands/account/view.go:45
  git.sr.ht/~sircmpwn/aerc/commands.(*Commands).ExecuteCommand
          commands/commands.go:66
  main.execCommand
          aerc.go:61
  main.main.func2
          aerc.go:160
  aerc crashed: runtime error: invalid memory address or nil pointer
  dereference

Check the pointer before dereferencing.

Also, add a global check in ParseMessageFormat where a similar issue may
occur.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-10-28 16:38:23 +02: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
Robin Jarry 42b4302ba3 index: allow dynamic formatting of message dates
When a message has been sent today (or this year) allow formatting the
date differently.

For example, with:

 [ui]
 index-format=%-25.25n   %-25.25D   %s
 timestamp-format=2006 Jan 02, 15:04 GMT-0700
 this-day-time-format=Today at 15:04
 this-year-time-format=Jan 02

The message list would look like this (spaces collapsed):

 Robin Jarry        Today at 16:30             [PATCH 1/2] bindings: prepare for more modifers
 bugzilla@dpdk.org  Oct 26                     [dpdk-dev] [Bug 839] pdump: any subsequent runs of pdump_autotest fail
 Holger Levsen      2020 Mar 15, 13:44 GMT+01  +1 (Re: FTP Team -- call for volunteers)

Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-10-28 16:30:59 +02:00
Robin Jarry fea57839fb filters: allow matching any email header
In addition of the common headers (subject, to, from, cc), allow
matching arbitrary email headers in filters. E.g.:

  x-bugzilla-severity,critical=tput setaf 1; cat;tput sgr0

Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-10-28 16:22:33 +02:00
Robin Jarry 1a75906bcb bindings: support more modified keys
Add new supported keys:

  Ctrl+Enter
  Ctrl+Up
  Ctrl+Down
  Ctrl+Left
  Ctrl+Right
  Ctrl+PageUp
  Ctrl+PageDown

Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-10-28 16:22:28 +02:00
Robin Jarry 7a6c808c04 bindings: prepare for more modifers
Prepare to support more modifiers in key bindings.

tcell has some premade ctrl-modified keys but not all keys are
supported. Other keys must be explicitly checked with a modifier mask.

Update the KeyStroke type to carry a modifier mask. Update code
accordingly.

No functional change.

Link: https://github.com/gdamore/tcell/blob/master/key.go#L265-L275
Link: https://github.com/gdamore/tcell/blob/master/key.go#L384-L419
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-10-28 16:21:37 +02:00
Adnan Maolood 0b19b5e70e lib/ui/textinput: Optimize ensureScroll 2021-08-30 14:58:09 +02:00
Noam Preil d39c6b449e README: freenode -> libera.chat 2021-08-26 09:18:56 +02:00
Reto Brunner 1687e558d3 notmuch/maildir: remove double emit of the dirinfo
There was some bug which could be worked around by double emitting an event.
However that proofed to be brittle:

We send the first message here from the worker goroutine:
https://git.sr.ht/~sircmpwn/aerc/tree/a5553438/item/worker/maildir/worker.g=
o#L306

Then Tick() is waked in the main goroutine and calls ProcessMessage:
https://git.sr.ht/~sircmpwn/aerc/tree/a5553438/item/widgets/account.go#L100

ProcessMessage in the main goroutine reads types.Message state with
msg.getId() and msg.InResponseTo():
https://git.sr.ht/~sircmpwn/aerc/tree/a5553438/item/worker/types/worker.go#=
L74-76

Meanwhile in the worker goroutine we call PostMessage for a second
time with a pointer that points to the *same* previous message that
ProcessMessage is reading:
https://git.sr.ht/~sircmpwn/aerc/tree/a5553438/item/worker/maildir/worker.g=
o#L306

The second PostMessage call makes writes to message while
ProcessMessage in the main goroutine is possibly reading:
https://git.sr.ht/~sircmpwn/aerc/tree/a5553438/item/worker/types/worker.go#=
L59

This led to a data race in the event loop

Reported-By: Wagner Riffel <w@104d.net>
2021-04-28 07:54:16 +02:00
Reto Brunner 60c5a82a76 load config: do not overwrite the config upon error
It makes absolutely no sense to copy over the default template from aerc.conf
when the syntax is invalid and our ini parser fails.

The only valid case to do that is if the file is actually missing.
2021-04-17 18:57:19 +02:00
Clayton Craft 98d778eeae widgets/terminal: Only call vterm.ScreenCell.Attrs once in styleFromCell
This fixes a substantial performance issue when scrolling emails with
long/complicated contents, where scrolling down a single line can take
something like hundreds of ms before the screen is updated to reflect
the scroll. It's really bad if the email has lots of columns, e.g. like
if it's an html email that was passed through a filter (w3m, etc) to
render it.

Using pprof, I found that the multiple calls to vterm.ScreenCell.Attrs()
in styleFromCell were really really expensive. This patch replaces them
with a single call.

Here's a before and after with a simple, but very manual test of opening
a large email with contents that went through a w3m filter and
continuously scrolling up and down over and over for ~30 seconds:

*** Before:

----------------------------------------------------------+-------------
      flat  flat%   sum%        cum   cum%   calls calls% + context
----------------------------------------------------------+-------------
                                            28.25s   100% | git.x2esr.x2eht..z2f..z7esircmpwn..z2faerc..z2fwidgets.PartSwitcher.Draw
         0     0% 99.94%     28.25s 82.31%                | git.x2esr.x2eht..z2f..z7esircmpwn..z2faerc..z2fwidgets.PartViewer.Draw
                                            28.25s   100% | git.x2esr.x2eht..z2f..z7esircmpwn..z2faerc..z2fwidgets.Terminal.Draw
----------------------------------------------------------+-------------
                                            28.25s   100% | git.x2esr.x2eht..z2f..z7esircmpwn..z2faerc..z2fwidgets.PartViewer.Draw
         0     0% 99.94%     28.25s 82.31%                | git.x2esr.x2eht..z2f..z7esircmpwn..z2faerc..z2fwidgets.Terminal.Draw
                                            19.23s 68.07% | git.x2esr.x2eht..z2f..z7esircmpwn..z2faerc..z2fwidgets.Terminal.styleFromCell
                                             6.04s 21.38% | github.x2ecom..z2fddevault..z2fgo..z2dlibvterm.Screen.GetCellAt
                                             1.38s  4.88% | git.x2esr.x2eht..z2f..z7esircmpwn..z2faerc..z2flib..z2fui.Context.Printf
                                             0.62s  2.19% | runtime.mapassign
                                             0.43s  1.52% | runtime.mapaccess2
                                             0.20s  0.71% | runtime.newobject
                                             0.19s  0.67% | runtime.callers (inline)
                                             0.07s  0.25% | runtime.makeslice
                                             0.07s  0.25% | runtime.mallocgc
----------------------------------------------------------+-------------
                                            19.23s   100% | git.x2esr.x2eht..z2f..z7esircmpwn..z2faerc..z2fwidgets.Terminal.Draw
         0     0% 99.94%     19.23s 56.03%                | git.x2esr.x2eht..z2f..z7esircmpwn..z2faerc..z2fwidgets.Terminal.styleFromCell
                                            19.21s 99.90% | github.x2ecom..z2fddevault..z2fgo..z2dlibvterm.ScreenCell.Attrs

*** After:

----------------------------------------------------------+-------------
      flat  flat%   sum%        cum   cum%   calls calls% + context
----------------------------------------------------------+-------------
                                             0.31s   100% | git.x2esr.x2eht/~sircmpwn/aerc/widgets.Terminal.Draw
         0     0% 99.87%      0.31s  1.33%                | github.x2ecom/ddevault/go-libvterm.NewPos
                                             0.25s 80.65% | runtime.callers (inline)
                                             0.04s 12.90% | runtime.gomcache (inline)
----------------------------------------------------------+-------------
                                             8.40s   100% | github.x2ecom/ddevault/go-libvterm.Screen.GetCellAt
         0     0% 99.87%      8.40s 36.11%                | github.x2ecom/ddevault/go-libvterm.Screen.GetCell
                                             7.14s 85.00% | github.x2ecom/ddevault/go-libvterm._cgoCheckPointer
                                             0.54s  6.43% | runtime.callers (inline)
                                             0.35s  4.17% | runtime.exitsyscall
                                             0.11s  1.31% | runtime.deferprocStack
                                             0.07s  0.83% | doentersyscall
                                             0.07s  0.83% | runtime.getg
                                             0.05s   0.6% | runtime.casgstatus
                                             0.03s  0.36% |   _init
                                             0.03s  0.36% | runtime.gomcache (inline)
----------------------------------------------------------+-------------
                                             8.46s   100% | git.x2esr.x2eht/~sircmpwn/aerc/widgets.Terminal.Draw
         0     0% 99.87%      8.46s 36.37%                | github.x2ecom/ddevault/go-libvterm.Screen.GetCellAt
                                             8.40s 99.29% | github.x2ecom/ddevault/go-libvterm.Screen.GetCell
                                             0.06s  0.71% | runtime.callers (inline)
----------------------------------------------------------+-------------
                                             0.31s   100% | git.x2esr.x2eht/~sircmpwn/aerc/widgets.Terminal.styleFromCell
         0     0% 99.87%      0.31s  1.33%                | github.x2ecom/ddevault/go-libvterm.ScreenCell.Attrs
)
2021-04-13 01:32:45 +02:00
wagner riffel a555343893 config: proper error handle [filters] config
Instead of panic when compiling a regular expression, return it up

Signed-off-by: wagner riffel <w@104d.net>
2021-04-12 18:21:03 +02:00
Eric Bower 548facab92 fix typo in quoted reply template 2021-03-07 23:25:04 +01:00
Reto Brunner a19c1fb65b templates: fixup error in template modification
The change of WrapText --> Wrap left the order of the arguments unchanged, which
is wrong.
2021-03-07 15:17:08 +01:00
Nícolas F. R. A. Prado 3df88f7040 templates: Use wrap instead of wrapText
bf0f72a533 ("template: add exec and wrap") introduced wrap which
allowed to chain wrapText. It also changed the aerc-templates man page
to document wrap instead of wrapText. The templates weren't updated
then, so update now.
2021-03-07 14:53:37 +01:00
Reto Brunner 413fc431f7 add mimeType to OriginalMail struct for both forward and reply 2021-03-07 14:52:42 +01:00
Reto Brunner f74605793e FindFirstNonMultipart: return the proper path
There was a bug that lead to the wrong path being returned by the function.
2021-03-07 14:52:42 +01:00
Reto Brunner 8cd2485170 send: fix missing error return 2021-02-28 02:05:12 +01:00
Reto Brunner 8b4f2d148c Fix linter warnings
* Remove redundant return (code was never reached)
* Remove redundant type information
* Rename unused function parameters to "_"
2021-02-26 22:14:58 +01:00
Reto Brunner fda424bebc lib/parse: simplify parseAddressList 2021-02-22 11:47:31 +01:00
Reto Brunner c06a2e61fc aerc: try to recover from a panic
As of now we crash fairly often. The problem is that we didn't run the cleanup
routine of the ui in this case, leaving the pty in a bad state.
Instead, recover from a panic and at least try to run the ui deinit.
2021-02-11 21:02:46 +01:00
Reto Brunner 8ecf0b73f4 maildir: don't read the full file into memory 2021-02-08 09:06:42 +01:00
Reto Brunner db6848fe1b notmuch: don't read the full file into memory 2021-02-08 08:40:07 +01:00
Reto Brunner 077063ba4b Makefile: use git version string if we can
Some packagers overwrote the version we embed in aerc, we really don't want that.
Hence we force clear the variable at the beginning of the makefile.
If git is available and returns a useful info we now use that version instead
of the hardcoded version
2021-02-07 19:25:06 +01:00
Alexey Yerin 804329970b terminal: Add support for Shift+Tab 2021-02-07 10:11:31 +01:00
Reto Brunner 2d2010fd42 send: fix crash if invalid password is given 2021-02-05 21:20:17 +01: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
Reto Brunner 949781fa0a Refactor lib/open to accept user provided arguments
* Get rid of open_darwin
	It just lead to code duplication for a simple one string change.
	Instead we query it during initialization
* Accept user provided arguments
	"open" on MacOS accepts things like -A to use a specific application
	Pass trough arguments the user provided in order to facilitate this
* Refactor the function to a struct
	This makes it more convenient for the caller and avoids signatures like
	lib.OpenFile(nil, u.String(), nil) which are fairly unreadable
2021-01-30 14:04:23 +01:00
Reto Brunner 9385827cae send: don't block the UI thread during the sending 2021-01-24 18:00:23 +01:00
Robin Opletal 3720c86236 save: if part name is a path, only use the filename 2021-01-14 07:17:23 +01:00
Bor Grošelj Simić bbe8ba5b31 correct permission check on accounts.conf 2021-01-14 06:40:44 +01:00
Eyal Sawady d344ceecfe compose: apply default style to header separator 2021-01-14 06:36:09 +01:00
Reto Brunner 0e554a879d trim <> from messageIDs when handling mailto links
Co-authored-by: James Walmsley <james@fullfat-fs.co.uk>
2021-01-12 20:22:34 +01:00
Eyal Sawady 7371d91b3c Apply dirlist style to unselected directories 2021-01-12 20:07:36 +01:00
Shaw Vrana 3c14c2cb34 Reapply 'Fix nil pointer deref on Envelope'
The commit bf16ccde48 appears to have been
unintentionally dropped by commit 905cb9dfd3
(Implement style configuration).
2021-01-03 09:08:27 +01:00
y0ast 889d89b42e Freshen up readme with binary packages 2020-12-27 10:02:47 +01:00
Bor Grošelj Simić 91f29206a3 s/RFC 8022/RFC 2822/ 2020-12-26 13:10:53 +01:00
y0ast da265a56e4 Make makefile compatible with 3.81 (default MacOS)
Enables using the makefile with mac default make.
2020-12-24 10:56:16 +01:00
y0ast 3edbe0c67c add italics support
Fixes: https://todo.sr.ht/~sircmpwn/aerc2/416

Co-authored-by: JD <john1doe@ya.ru>
2020-12-24 10:26:18 +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 af0a2b9a46 Use extensions for querying the mime type of attachments
This gets rid of the issue that lots of things are detected as zip files, even
though they are a more specialized format (say office files)
2020-12-15 21:48:25 +01:00
Reto Brunner 83202dcb2e fix aerc-stylesets(7) typos 2020-12-13 10:30:56 +01:00
Kalyan Sriram b56a688589 notmuch: trim excluded tags
Trims whitespace in list of excluded notmuch tags. This allows a comma
separated list with spaces to be correctly processed.
2020-12-02 09:08:19 +01:00
Reto Brunner a9330f4c63 notmuch: remove gc close hooks
We frequently had issues with notmuch segfaulting and my guess is that this
was due to the garbage collection magic used in the module.

This changes to a fork that ripped the functionality out.
2020-12-02 09:06:34 +01:00
Reto Brunner 7bc556740a fix mailto parsing 2020-11-28 15:45:46 +01:00
Reto Brunner 67923707ff Refactor send command 2020-11-21 15:40:50 +01:00