| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
Use the updated completion and avoid removing flag when completing paths.
Fixes: https://todo.sr.ht/~rjarry/aerc/110
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
| |
Update the completion system by implementing the OptionsProvider
interface.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
| |
Align the completion popover with the actual completion location on the
textinput line.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix cursor index after stemming and reset it to the position where the
completion should occur. Only stem to add more information and not
remove any user input.
Stemming is activated on the textinput line when the user presses the
Tab key. The idea of stemming is to adjust the textinput line to the
common ground (="the stem") of the completions options.
When the stemmed input line is set, however, the cursor will be moved to
the end of the line if there is a text part on the right side of the
cursor where the completion should occur. Another Tab press will
activate the onStem function again, which then removes the right part of
the text input leading to the loss of the user input.
This can be prevented by moving the cursor to the place of the
completion after stemming.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Execute template code before running a command.
With this, we can use templates in our keybinds like:
[messages]
E = :'{{if match (.Flags|join "") "O"}}envelope{{else}}view{{end}}'<Enter>
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Expand and complete template code. The exline does understand template
code and can evaluate it. With this patch, the completion systems
supports writing the templates by showing the available template data
fields and template functions. Pressing <Tab> after }} will show the
evaluated template in the completion menu. Complex template code, such
as if-else statements work as well.
Examples:
:filter -f {{<Tab>
will show the possible template data fields and functions
:filter -f {{index (.To|email) 0}}<Tab>
will show the value of the template expression in the completion list
Pressing <Tab> twice after a completed template expression will
substitute the expression with its value.
:{{if match .Folder "INBOX"}}check-mail{{else}}cf INBOX{{end}}
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Improve command completion by supporting option flags and option
arguments completion. Option completion is activated when the command
implements the OptionsProvider interface. Implementing the
OptionCompleter allows the completion of individual option arguments.
The completion interfaces harmonizes the completion behavior in aerc,
makes the completion code clearer and simplifies the completion
functionality.
With this patch, the Complete method on commands will only have to deal
with the actual completion, i.e. paths, folders, etc and not worry about
options. To remove all options and its mandatory arguments from args,
use commands.Operands().
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
| |
Retrieve message size not only in the MessageInfo but also in the
MessageHeaders function. The MessageHeaders function is used for an
memory-optimized maildir sorting. This fixes sorting by size in the
maildir backend.
Fixes: f04d83e8 ("messageinfo: report message sizes")
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Update the dirtree drawing structure to be a bit more compact. The
dirtree is drawn with one column left for a flag, which indicates if a
parent is collapsed or expanded. Only draw the "flag" when the parent is
collapsed. Change the flag to a '+' character to match common UI
patterns of expanding lists having a '+' box.
Don't draw the '>' character in the dirtree. This character is nice in
the threaded message view, but clutters up the dirtree. I know this is a
matter of preference, but this approach is similar to most other UI tree
view and gives the dirtree an extra column of space.
The original dirtree looks like this:
┌Inbox
├─>Sub
└─>Sub
And collapsed:
-Inbox
This patch changes it to:
Inbox
├─Sub
└─Sub
And collapsed:
+Inbox
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
|
|
|
|
| |
Signed-off-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
| |
Hopefully, this will be the last 0.15 bugfix release.
Signed-off-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit ef4504e6baf5 ("maildir: fix handling of FSEvents") ambitiously
tried to fix handling of file system events by handling different events
in "proper" ways. Distributions and OSes report these FSEvents
differently which creates a large amount of edge cases on what the right
handling of each individual event should be.
Revert part of ef4504e6baf5 which attempts to issue different messages
based on the event. Add a debounce to file system events and always
trigger a Refetch of the message list. This still fixes one of the
"fixes" the referenced patch attempted at, where the UI was only told to
refetch if the message count increased (but if messages disappeared
externally, the maildir never updated).
Fixes: ef4504e6baf5 ("maildir: fix handling of FSEvents")
Reported-by: Kirill Chibisov <contact@kchibisov.com>
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Kirill Chibisov <contact@kchibisov.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The msgstore trims the uid list when a message was deleted. It does so
whether the message is in the message store or not. If the message was
already deleted and a MessagesDeleted is received, the store will be
trimmed regardless. This can cause spurious emails to be removed from
the msgstore due to a race condition with the fs watcher / imap update
channel. When a message is deleted, the UI will received two
MessagesDeleted and in some cases trim the list, removing too many
emails.
Fix the handling of deleted messages so that the uid list is rebuilt of
all messages except the deleted ones specifically.
Reported-by: Drew Devault <sir@cmpwn.com>
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Inwit <inwit@sindominio.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When running colorize or wrap on ARM, both programs exit immediately
displaying their help message whatever the provided arguments. This is
caused by an implicit downcast of the getopt return value.
On most architectures, char is signed by default. On ARM, char is
unsigned for performance reasons. Since the signed int return value of
getopt is forced into a char, the results differ on ARM compared to x86.
* Add -Wconversion -Warith-conversion to CFLAGS in CI builds to ensure
catching such issues in the future.
* Fix all -Wconversion -Warith-conversion reported issues.
* Wide char functions need to deal with wint_t and wchar_t and it is
guaranteed that a wchar_t can always fit into a wint_t. Add explicit
casts to silence the reported warnings.
Link: https://www.arm.linux.org.uk/docs/faqs/signedchar.php
Link: https://lwn.net/Articles/911914/
Fixes: https://todo.sr.ht/~rjarry/aerc/164
Reported-by: Bence Ferdinandy <bence@ferdinandy.com>
Suggested-by: Allen Sobot <chilledfrogs@disroot.org>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
|
|
|
|
| |
Signed-off-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
| |
Signed-off-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Maildir uses a filesystem watcher to watch the currently selected
directory for changes, updating the UI as necessary. Not all changes get
updated based on the current logic. Send a MessageInfo if the event was
a Rename. Send a MessagesDeleted if the event was a Remove. Tell the UI
to refetch the list if the event was a Create.
Note: This leads to some unnecessary fetching in the UI, as renames also
come with a Create event in most cases. Koni suggested sending the
MessageInfo and having the UI perform a binary search and inserting the
message in the proper position. This is optimization is left out of this
series, with a TODO left in the code.
Fixes: https://todo.sr.ht/~rjarry/aerc/171
Fixes: 91ac21ac6155 ("msgstore: fetch message list based on OpenDirectory msg")
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
| |
Upgrade tcell-term, includes a bug fix when CUP is sent with only one
param.
Fixes: https://todo.sr.ht/~rjarry/aerc/170
Tested-by: ~staceeharper
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
| |
Only strip the leading whitespace when a delimiter needs to be
prepended.
Fixes: bba715975690 ("compose: only add delimiter when a signature is defined")
Reported-by: Jason Cox <dev@jasoncarloscox.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Jason Cox <dev@jasoncarloscox.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When calling ui.QueueRedraw() and a redraw is currently in progress, the
redraw int value still holds REDRAW_PENDING since it is updated once the
redraw is finished. This can lead to incomplete screen redraws on the
embedded terminal.
Even changing the redraw value before starting to redraw is exposed to
races. Use a single atomic int to represent the state of the UI so that
there cannot be any confusion.
Rename the constants to make them less confusing.
Fixes: b148b94cfe1f ("ui: avoid duplicate queued redraws")
Reported-by: Jason Cox <dev@jasoncarloscox.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Jason Cox <dev@jasoncarloscox.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Avoid such errors in the logs:
ERROR cache.go:187: cannot clean database 0: unexpected EOF
The cache now contains a tag mapped to a special key. This is not
a gob serialized cached header. Ignore it when pruning old cache
entries.
Fixes: 6ea0f18635a8 ("imap: clear cache on tag mismatch")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
| |
Signed-off-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
| |
No need to queue multiple nil messages to force multiple redraws. Only
one is required. When the screen is redrawn, clear the queued redraw
flag.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A panic occurs when a terminal is launched with a command that fails:
:term blabla
The underlying terminal does not need to be closed if the command failed
to start: all resources are cleaned up upon failure to start already.
Don't attempt to close terminal if the command didn't start.
With the above fix in place, the tab will linger around until a redraw
occurs, as there is nothing queuing a redraw on this behavior. Add a
QueueRedraw in the tabs.Remove method to clean up the tabbar.
The issue in tcell-term that causes this panic has been address there as
well, released as 0.7.1. Update aerc's version.
Reported-by: Koni Marti <koni.marti@gmail.com>
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
| |
Add size field to the cache struct and increment cache tag.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
| |
Tag the imap cache and clear it when the cache tag does not match the
current tag in the code. This ensures that the cache structure is always
consitent with our code base.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
| |
Report sizes of the message across all backends.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Result of the following commands:
go get -u -t
go mod tidy -compat=1.18
I also updated gofumpt version in the makefile. golangci-lint cannot be
updated to 1.52.* which requires go 1.19 or later. Aerc has a minimum
required version of 1.18.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Bence Ferdinandy <bence@ferdinandy.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A lot of libraries are starting to use generics (introduced in go 1.18).
Restricting aerc on 1.17 prevents us from updating our dependencies.
Since 1.18 is a major milestone, it has a chance to remain supported for
a while.
Update the minimum go version to 1.18. Run go mod tidy -compat=1.18.
Update our CI to run on 1.18.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Bence Ferdinandy <bence@ferdinandy.com>
|
|
|
|
|
|
|
| |
These slipped through the cracks.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Bence Ferdinandy <bence@ferdinandy.com>
|
|
|
|
|
|
|
|
| |
Add config options for setting the TERM environment variable used in
tcell-term and for enabling or disabling OSC8 escape sequence output.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry<robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Upgrade tcell-term to latest release.
This is a complete rewrite of tcell-term, and includes many minor bug
fixes and overall improvements. Notably:
- Improved parsing
- One fewer goroutine
- Improved API
- Improved redraw messaging
- Improved key support
- Improved mouse support
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry<robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
| |
According to RFC 1123:
"... a host domain name is now allowed to begin with a digit and could
legally be entirely numeric ..."
Link: https://datatracker.ietf.org/doc/html/rfc1123#section-2
Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Bence Ferdinandy <bence@ferdinandy.com>
|
|
|
|
|
|
|
|
|
| |
Add template parameter to the mailto query and set the
config.Template.NewMessage template file as default.
Fixes: https://todo.sr.ht/~rjarry/aerc/145
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry<robin@jarry.cc>
|
|
|
|
|
|
|
|
|
| |
Handle headers in the search and filter commands, for searching and
filtering based on the Headers specified by the -H parameter, the syntax
for the -H parameter should be `Header: Key`.
Signed-off-by: Julian Marcos <jmjl@tilde.green>
Acked-by: Robin Jarry<robin@jarry.cc>
|
|
|
|
|
|
|
|
|
| |
Add .Role as a template field for use in distinguishing between
mailboxes with a given IANA role, or custom role defined by aerc
("query" for notmuch queries, for example).
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry<robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
| |
Add IANA registered mailbox role, and a custom aerc role "query". This
will be used in subsequent commits which add the Role field to
templates, allowing users to style mailbox by IANA role, or style
notmuch queries differently than maildir dirs when using the notmuch
worker + maildir option.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry<robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Store the Directory RUE counts on the Directory data model. Use
DirectoryInfo messages to update the Directory model. Access Directories
via the dirlist instead of via the msgstore. Remove unused fields on
DirectoryInfo, all backends now give accurate counts.
Move refetch logic into dirlist
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry<robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
| |
All other backends automatically update directory counts by sending a
directory info when a flag operation is performed. Unify the imap
backend to this model by posting a CheckMail action, which requests an
updated status from the server and posts a DirectoryInfo message
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry<robin@jarry.cc>
|
|
|
|
|
|
|
|
| |
Use the dirstore to store models.Directory data structures. This will be
used in subsequent commits for accessing directory data.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
| |
Remove the unused field Attributes
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ListDirectories is called when connecting, reconnecting, and
creation/deletion of a directory. The code is not in the same style as
other areas of aerc. Refactor to match coding style of the rest of aerc
by creating an Update function which handles necessary updates in the
dirlist. This style does not use a callback, making it clearer what is
happening in the message flow, and operates similar to how the msgstore
receives updates.
Use a map in the dirstore to reduce duplicate storage of directory
names. Directly add or remove directories from the map when created /
deleted to prevent a new ListDirectories message, and a flash of the UI.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Create msgstores when a types.Directory message is received. This
removes a quirk from the IMAP worker that msgstores are created on the
first DirectoryInfo, and updated on the second. This path requires three
messages in order to get an updated message store. By creating from
types.Directory, we ensure that any subsequent DirectoryInfo can be
routed to a msgstore.
Remove the field DirInfo from the msgstore initializer, it isn't needed
at initialization and isn't available with this refactor.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use the Backend interface to report Backend capabilities. Previously,
these were reported via a DirectoryInfo message, however they have
nothing to do with a directory and should be reported directly by the
backend. Add Capabilities method to Backend interface, satisfy this in
each backend, and use it on the UI side.
Remove Caps field from DirectoryInfo
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry<robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Mailbox status updates received from the IMAP server do not come with
the information being sent to the UI. Use the update signal to instead
trigger a check-mail of the directory the status was sent for.
The status update comes with the following data:
- Messages in the mailbox
- Recent messages in the mailbox
- Sequence number of the first Unseen message
- Flags in the mailbox
The data we actually we want to send to the UI:
- Messages in the mailbox
- Recent messages in the mailbox
- Unseen messages in the mailbox
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fetching the message list is done in a convoluted way. The UI receives a
DirectoryInfo message, which creates a message store. It then receives a
second DirectoryInfo (an oddity from the IMAP worker), and this
DirectoryInfo is passed to the message store which then requests a fetch
of the message list via store.Sort.
Use the OpenDirectory done response to tell the message store to fetch
messages. This makes the code easier to follow, and does not rely on
quirks from the IMAP worker.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
| |
Printing an ID in the OSC8 terminator can cause issues in some pagers
and/or terminals. The "spec" doesn't allow for an ID in the terminator,
but most applications and terminals will ignore it if it's there.
Prevent printing it in the first place for better compatibility.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is mostly a revert of commit ae4d742c5a90 ("templates: fix layered
fg & bg color for inline styles").
As it turns out, context colors (msglist_selected, msglist_marked,
msglist_deleted, etc.) need to have priority over inline colors.
Otherwise strange and confusing results occur.
Reported-by: Skejg <grolleman@zoho.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
|
|
|
|
| |
When a terminal widget title is updated, the screen is not redrawn. Only
the UI state is invalidated so that on the next redraw, the title will
be refreshed.
Make sure that the screen is redrawn when the title changes.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Inwit <inwit@sindominio.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Another attempt at fixing the high CPU usage when terminal tabs are
running interactive tui applications and the message list tab is
selected.
There are cases where a terminal widget can be visible but not focused
(composer, message viewer, attachment selector, etc.). Define a new
Visible interface with a single Show() method. Call that method when
changing tabs to make sure that terminal widget content events only
trigger redraws when they are visible.
Fixes: 382aea4a9426 ("terminal: avoid high cpu usage when not focused")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Koni Marti <koni.marti@gmail.com>
|