aboutsummaryrefslogtreecommitdiffstats
path: root/commands/term.go
Commit message (Collapse)AuthorAgeFilesLines
* commands: refactor registrationRobin Jarry2024-01-201-1/+5
| | | | | | | | | | | | | | | | | | 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>
* patch/term: add term sub-cmdKoni Marti2023-12-301-5/+24
| | | | | | | | | Implement the :patch term command. This will open a shell in the project's root directory that was defined during the :project init setup. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* 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-12/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-7/+7
| | | | | | | | | | | | | | | 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-5/+5
| | | | | | | | | 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>
* ui: fix deadlocks in message channelRobin Jarry2023-05-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are several ways the ui message channel can fill up leading to deadlocks. 1) Invalidate() changes the value of uiState to DIRTY. The following call sequence: QueueRedraw() Invalidate() QueueRedraw() Leads to multiple nil messages being queued in the message channel whereas one could assume that the second QueueRedraw() would do nothing. This is caused by the tri-state nature of uiState. 2) We use the same channel to convey state change, keyboard events and redraw requests. Since a keyboard event almost always triggers a redraw, we end up trying to append a redraw message in the same goroutine that reads from the channel. This triggers a deadlock when there are more than 50 pending messages. Solve the issue by using multiple channels, one per type of message that needs to be sent to the main ui thread. Remove QueueRedraw() and merge its functionality in Invalidate(). Only use a DIRTY/CLEAN state to determine if something needs to be queued in the redraw channel. Use a channel for quitting instead of an atomic. Restructure some code functions to have a cleaner API. Use a for loop in the main thread and select from all channels. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Koni Marti <koni.marti@gmail.com> Tested-by: Maarten van Gompel <proycon@anaproy.nl>
* term: update tab title even when tab is not selectedRobin Jarry2023-04-151-2/+4
| | | | | | | | | | | 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>
* tabs: make sure to close tab contentRobin Jarry2023-04-011-1/+1
| | | | | | | | Rework how tabs are closed. Change the aerc.RemoveTab and aerc.ReplaceTab functions to accept a new boolean argument. If true, make sure to close the tab content. Signed-off-by: Robin Jarry <robin@jarry.cc>
* invalidatable: cleanup dead codeTim Culverhouse2022-10-121-1/+2
| | | | | | | | Remove invalidatable type and all associated calls. All items can directly invalidate the UI. 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>
* Get rid of the aerc.PushError(" " + $string) idiomReto Brunner2021-01-301-1/+1
| | | | The individual callers should not be responsible for padding
* Revert "Add Style configuration"Drew DeVault2020-05-281-2/+1
| | | | This reverts commit 0f78f06610c0e8887aba2ae50e99b86477a384b3.
* Revert "Remove duration from the status methods"Drew DeVault2020-05-281-1/+2
| | | | This reverts commit f06d683688e3d2139b14f67b7e349089e7200bf4.
* Remove duration from the status methodsReto Brunner2020-05-271-2/+1
| | | | We always set 10 seconds anyhow, might as well do that without repeating ourselfs.
* Add Style configurationReto Brunner2020-05-271-1/+2
| | | | | | | | | | 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
* gofmt fixesDrew DeVault2020-04-241-1/+1
|
* Use aerc.PushError where appropriateBen Fiedler2020-04-231-6/+3
| | | | Forgot an unused import, to save you the hassle here is v2.
* all: purge redundant underscoresWagner Riffel2019-09-041-3/+3
| | | | Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
* Implement basic tab completion supportGregory Mullen2019-06-291-2/+17
| | | | | Tab completion currently only works on commands. Contextual completion will be added in the future.
* s/aerc2/aerc/gDrew DeVault2019-05-171-1/+1
|
* Add basic message viewer mockupDrew DeVault2019-03-301-3/+2
|
* Correct color of error messagesDrew DeVault2019-03-301-1/+1
|
* Add context-specific commandsDrew DeVault2019-03-211-1/+1
|
* Wrap Terminal in TermHostDrew DeVault2019-03-171-10/+3
|
* Add :term-closeDrew DeVault2019-03-171-2/+11
|
* Handle terminal title, login shellDrew DeVault2019-03-171-5/+16
|
* Move exline handling up to aerc, add :termDrew DeVault2019-03-171-0/+33