aboutsummaryrefslogtreecommitdiffstats
path: root/commands/msg/mark.go
Commit message (Collapse)AuthorAgeFilesLines
* treewide: replace uint32 uids with opaque stringsRobin Jarry2024-08-281-2/+3
| | | | | | | | | | | | | | | | | Add a new models.UID type (an alias to string). Replace all occurrences of uint32 being used as message UID or thread UID with models.UID. Update all workers to only expose models.UID values and deal with the conversion internally. Only IMAP needs to convert these to uint32. All other backends already use plain strings as message identifiers, in which case no conversion is even needed. The directory tree implementation needed to be heavily refactored in order to accommodate thread UID not being usable as a list index. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* commands: rename confusing constantsRobin Jarry2024-03-041-1/+1
| | | | | | | | There is an overlap between ACCOUNT and MESSAGE. Rename ACCOUNT to MESSAGE_LIST and use MESSAGE_LIST|MESSAGE_VIEWER instead of MESSAGE. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Tim Culverhouse <tim@timculverhouse.com>
* commands: refactor registrationRobin Jarry2024-01-201-1/+7
| | | | | | | | | | | | | | | | | | Register all commands with the same function and store them in the same map. Use bit flags to determine in which contexts each command should be available. Remove duplicate commands now that the same command can be exposed in multiple contexts. Refactor API to allow executing commands from other commands without import cycles. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Johannes Thyssen Tishman <johannes@thyssentishman.com>
* commands: use completion from go-optRobin Jarry2023-10-281-4/+0
| | | | | | | | | | | Implement command completion with complete struct field tags from the get-opt library introduced earlier. Changelog-changed: Improved command completion. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
* commands: parse arguments with go-optRobin Jarry2023-10-281-46/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | Use the argument parsing framework introduced earlier to unify the parsing of (almost) all command options. Remove custom parsing code and to avoid extraneous types, add fields with `opt` tags on command structs that have options and arguments. Commands that take no argument do not need anything. Since the command objects now carry data, create a new temporary instance of them before passing them to opt.ArgsToStruct when executing a command. A few of the commands use specific semantics for parsing (:choose), or are delegating argument parsing to another function (:sort, :search, :filter). For these commands, simply add a dummy "-" passthrough argument. Since all commands still have the argument list (after split) nothing needs to be changed in this area. There should be no functional change besides the Usage strings and reported errors which are now generated automatically. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>
* app: export global functionsRobin Jarry2023-10-101-4/+3
| | | | | | | | | | | | | | | The single Aerc object is passed around in almost all command functions. This hinders readability. Store the single Aerc instance as a global variable. Export public functions from the app package to access methods of that object. Remove all explicit references to *app.Aerc and replace them with calls to these functions. For references to private/unexported fields and functions from within the app package, directly access the global aerc object. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* widgets: rename package to appRobin Jarry2023-10-101-3/+3
| | | | | | | | | This is the central point of all aerc. Having it named widgets is confusing. Rename it to app. It will make a cleaner transition when making the app.Aerc object available globally in the next commit. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* threadbuilder: store uid/thread associationKoni Marti2023-07-161-6/+10
| | | | | | | | | | | | | | Store the association between uids and threads in a map instead of just having the threads in a slice. This simplifies the lookup of a thread when we have an uid and we can avoid computationally expensive tree walks. The threadbuilder will rebuild the uids from the given thread structure. Hence there is no need now to keep a threads slice around. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc> Tested-by: inwit <inwit@sindominio.net>
* mark: fix (un)mark -a when no message is selectedKoni Marti2022-09-291-5/+12
| | | | | | | | | | | | | Call SelectedMessage() in the mark command only when the uid of the currently selected message is actually needed. If no message is selected, i.e. after some filter operations where the previously selected message is not in the results, 'mark -a' would fail since no message is selected and an error is returned from SelectedMessage() even though this is not necessary to mark or unmark all messages. Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* mark: (un)mark message threadsKoni Marti2022-08-221-4/+31
| | | | | | | | | Mark or unmark the shown message threads. Threads must be available in the message store. Use the -T option for the mark or unmark commands. Can be used in combination with the toggle flag (-t). Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* mark: allow multiple visual selectionsKoni Marti2022-08-221-2/+6
| | | | | | | | | When entering visual selection mode, the current selection is deleted. This patch extends the visual mode behavior to select multiple blocks of messages. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* store: extract marking behavior and add testsKoni Marti2022-08-221-7/+8
| | | | | | | | Separate the marking functions from the message store and extract the marking behavior into its own class with tests. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: homogenize operations and minor fixes (gocritic)Moritz Poldrack2022-08-041-6/+8
| | | | | | | | | | | | | | | | | | 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>
* visual-mode: deselect messages after performing commandTim Culverhouse2022-06-141-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | In order to better align to vim functionality: deselect visual mode selections after performing a command on the selection. This patch also introduces a new command to allow for re-selecting (remarking) the previous selection set so that commands can be chained together. The deselection only applies to msg commands that *do not* move the message from the store (those types of commands already deselect): - read/unread - flag/unflag - modify-labels - copy - pipe Previous usage to mark several messages as read and deselect all: Vjjj:read<Enter>:unmark -a<Enter> New usage, similar to vim: Vjjj:read<Enter> To chain a command together: Vjjj:read<Enter>:remark<Enter>{next command}<Enter> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* go.mod: change base git urlRobin Jarry2021-11-051-1/+1
| | | | | | | 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>
* Fix typosMartin Michlmayr2020-05-211-1/+1
|
* add mark commandReto Brunner2019-12-211-0/+98