summaryrefslogtreecommitdiff
path: root/lib/ui
AgeCommit message (Collapse)Author
2022-07-10fix panic on closing a tabMoritz Poldrack
This change fixes a panic caused by the selected tab being out of sync when selecting a new one in widgets.(*Aerc).SelectedTab(). This happens if the tab is already removed from the list of tabs, but the selection not yet being updated. This was achieved by moving the tabs behind updating the selection. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
2022-07-03uiconfig: use pointer references to uiConfigTim Culverhouse
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-05-06pgp: check encryption keys before sending messageTim Culverhouse
Add check for public keys of all message recipients (to, cc, and bcc) before sending the message. Adds an OnFocusLost callback to header editors to facilitate a callback for checking keys whenever a new recipient is added (OnChange results in too many keyring checks). Once encryption is initially set, the callbacks are registered. If a public key is not available for any recipient, encryption is turned off. However, notably, the callbacks are still registered meaning as s soon as the user removes the recipients with missing keys, encryption is turned back on. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Koni Marti <koni.marti@gmail.com>
2022-04-28grid: don't draw at a negative offsetConnor Kuehl
aerc panics when using macOS's default terminal emulator, Terminal.app, when closing all but aerc's tab: This error was also written to: /tmp/aerc-crash-20220427-194134.log panic: Attempted to create context with negative offset [recovered] panic: Attempted to create context with negative offset goroutine 1 [running]: git.sr.ht/~rjarry/aerc/logging.PanicHandler() /Users/ckuehl/src/aerc/logging/panic-logger.go:47 +0x58c panic({0x100d077a0, 0x14000032700}) /opt/homebrew/Cellar/go/1.18.1/libexec/src/runtime/panic.go:844 +0x258 git.sr.ht/~rjarry/aerc/lib/ui.(*Context).Subcontext(0x1400013e420?, 0x14000202360?, 0x140000ffc48?, 0x1009a10e4?, 0x100da9440?) /Users/ckuehl/src/aerc/lib/ui/context.go:47 +0x160 git.sr.ht/~rjarry/aerc/lib/ui.(*Grid).Draw(0x1400013e420, 0x14000202360) /Users/ckuehl/src/aerc/lib/ui/grid.go:143 +0x2bc git.sr.ht/~rjarry/aerc/widgets.(*Aerc).Draw(0x1400013e4d0, 0x14000202360) /Users/ckuehl/src/aerc/widgets/aerc.go:178 +0x30 git.sr.ht/~rjarry/aerc/lib/ui.(*UI).Tick(0x1400022bcc0) /Users/ckuehl/src/aerc/lib/ui/ui.go:116 +0x248 main.main() /Users/ckuehl/src/aerc/aerc.go:226 +0x9e8 I'm not entirely sure what the interactions are between the terminal emulator, aerc's grid, and the space that moves around when the tab bar disappears because there are no more tabs, but this fixes the issue 100% of the time and I haven't noticed any issues. Signed-off-by: Connor Kuehl <cipkuehl@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-04-17aerc: use contextual ui styleset for tabs/composeKoni Marti
Use contextual ui styleset for tabs and compose widgets. If no account is selected, use default styleset as fallback. Fixes: https://todo.sr.ht/~rjarry/aerc/3 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-25completion: install panic handler in completion callbackRobin Jarry
This callback is actually invoked in a goroutine by time.AfterFunc. The panic handler must be explicitly installed. Link: https://github.com/golang/go/blob/go1.18/src/time/sleep.go#L160-L173 Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
2022-03-23logging: added a log on panicMoritz Poldrack
Since panics still regularly "destroy" the terminal, it is hard to get a stack trace for panics you do not anticipate. This commit adds a panic handler that automatically creates a logfile inside the current working directory. It has to be added to every goroutine that is started and will repair the terminal on a panic. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
2022-02-03lib/ui/textinput: stop at /, ", and ' charsPranjal Kole
This matches the default behaviour of Ctrl+W in vim.
2022-01-07completions: add support for completing multiple addressesParasrah
as per the discussion https://lists.sr.ht/~sircmpwn/aerc/patches/15367 this handles completions in `completer/completer.go` by enabling the completer to return a `prefix` that will be prepended to the selected completion candidate.
2021-11-30style: customize vertical and horizontal border charactersDian M Fay
New border-char-horizontal and border-char-vertical config settings in aerc.conf allow users to modify border appearance from the default 1-wide/tall blank space. In stylesets, border.fg now affects the foreground color when custom characters are defined. Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-05go.mod: change base git urlRobin Jarry
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-10-28view,compose: use border color to separate headers from bodyRobin Jarry
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-08-30lib/ui/textinput: Optimize ensureScrollAdnan Maolood
2020-12-18update tcell to v2 and enable TrueColor supporty0ast
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-09-10Remove unused Simulator interfaceReto Brunner
2020-08-06Implement style configuration.Kalyan Sriram
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-30Revert "Implement style configuration."Reto Brunner
This reverts commit 1ff687ca2b0821c2cacc1fa725abb3302d2af9da.
2020-07-30Implement style configuration.Kalyan Sriram
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-06-09Make grid sizes dynamicJeffas
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-05-28Revert "Add Style configuration"Drew DeVault
This reverts commit 0f78f06610c0e8887aba2ae50e99b86477a384b3.
2020-05-27Add Style configurationReto Brunner
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-05libui: don't require beeper for main contentDrew DeVault
2020-05-05Fix array out of bounds errorburrowing-owl
2020-04-20fix: Close unused MessageView when swapping viewRay Ganardi
Closes https://todo.sr.ht/~sircmpwn/aerc2/379 The old `MessageView` was not closed when replacing the tab content, which causes a memory leak.
2020-03-09Add pinned tabsJeffas
This adds the commands pin-tab and unpin-tab. Once pinned a tab lives on the left of the tabstrip and has a configurable marker, defaulting to ` before its name.
2020-03-03Initial support for PGP decryption & signaturesDrew DeVault
2020-03-03Add move-tab commandJeffas
2020-01-09compose: don't call ti.tabcomplete when it is nilTimmy Douglas
2020-01-05Don't select completions until tab has been pressedBen Burwell
Before, pressing <Enter> when completions were visible would execute the selected completion. As soon as completions were provided, the first item would be selected. This could cause issues e.g. when changing folders: :cf <Enter> Previously, this would have selected the first folder in the list. Now, since <Tab>, <C-n>, etc have not been pressed to select the first completion, the command above simply executes `:cf `. To accomplish this, a "no-op completion" has been added at index -1.
2019-12-21Show textinput completions in popoversBen Burwell
Rather than showing completions inline in the text input, show them in a popover which can be scrolled by repeatedly pressing the tab key. The selected completion can be executed by pressing enter.
2019-12-21Add popoversBen Burwell
A popover is a special UI element which can be layered over the rest of the UI (i.e. it is painted last) and can fall anywhere on the screen, not just with the bounds of its parent's viewport/context. With these special abilities comes the restriction that only one popover may be visible on screen at once. Popovers are requested from the UI context passed to Draw calls and specify the anchor point and the desired dimensions. The popover is then fit to the available space and placed relative to the anchor point.
2019-11-17Add UI options to save/pipe messages with unsupported mimetypesGreg Anders
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-10-14Fix tab refocus on removeJeffas
Previously removing a tab would always pop from the history of tabs. This checks to see if the closing tab is the one selected, if it is then we use the history, otherwise we only need to change the selected tab if it was after (to the right of) the closing tab, in which case we just decrement the selected index.
2019-10-14Fix pushing invalid tabs to historyJeffas
A tab can now only be pushed onto the history if it is a selectable tab.
2019-09-18Focus new tab after removeJeffas
After removing a tab we should focus the newly selected tab if it is Interactive. This ensures things like the terminal get drawn properly.
2019-09-11Add MouseableJeffas
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-08-12Add delete forward <C-k> and backward <C-u>Christopher Vittal
Choose the readline defaults for the behavior of these two functions/keybindings. Depending on the program, either of these can delete the whole line. Note that by default in [compose], <C-k> is bound to :prev-field<Enter>. Leave it up to the user whether or not they want to rebind the key in [compose].
2019-08-03Remove aerc specific code from the uiNicolai Dagestad
Separatiing the ui code from aerc makes it usable as a library in other projects.
2019-07-29Ring bell when new messages arriveBen Burwell
Add a "new-message-bell" option to the UI section of aerc.conf. A new hook into the message store allows the msglist widget to detect new messages being added to the displayed list. When new messages are delivered, and the new-message-bell option is enabled (as it is by default), the terminal will beep.
2019-07-26Fix tabstrip over-drawing when not enough spaceJeffas
Tabstrip didn't take into account the width of the context. Now, it just shows as many tabs as can fit and truncates the last one if necessary. In future it probably would be best to ensure that the selected tab is rendered on the screen.
2019-07-26Add tab completion to textinputsJeffas
This adds tab completion to textinput components. They can be configured with a completion function. This function is called when the user presses <tab>. The first completion is initially shown to the user inserted into the text. Repeated presses of <tab> or <backtab> cycle through the completions list. The completions list is invalidated when any other non-tab-like key is pressed. Also changed is some logic for current completion generation so that all available commands are returned when <tab> is pressed with no current text and similarly for arguments of commands.
2019-07-26Fix invalid tab state when deselecting removed tabDrew DeVault
2019-07-25Fix :close on terminal panicJeffas
Executing :close on a terminal would panic due to it already having been removed. This is also related to the fact that removing a tab doesn't check for whether it actually found a tab to remove or not.
2019-07-25Fix grid creating too large subcontextsJeffas
The grid was not checking there was enough space for the cells so would just attempt to create subcontexts that don't actually fit. This attempts to use the remaining space and then if there is no space then it just skips drawing this cell.
2019-07-25Fix panic when tabs.popHistory is nonexistentDrew DeVault
2019-07-23Add change tab commandJeffas
This command allows the user to change tab by giving the tab name. This can be tab completed too. The previous tab is stored in the tabs module so that when a new tab is created it is still possible to go to the previous one. Normal invocation is :ct folder Previous tab is :ct -
2019-07-17Display user specified headers in viewer if presentDaniel Bridges
2019-07-17Fix grid widths when using weighted widthsJeffas
If the column weights do not collectively divide the extent of the grid layout then some width was not used and so would not be redrawn, resulting in previous drawings showing through. This fixes this by checking if there is any remainingExact width and if there is it is assigned to the weighted columns by their proportion from left to right.
2019-07-17Add MouseEnabled config settingJeffas
This patch adds the ability to control whether aerc captures mouseevents or not. By default it will be set to not capture events.
2019-07-17Fix text input cursor position with non-ASCII textTuomas Siipola
Fixes #171