aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ui
Commit message (Collapse)AuthorAgeFilesLines
* pgp: check encryption keys before sending messageTim Culverhouse2022-05-061-0/+14
| | | | | | | | | | | | | | | | 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>
* grid: don't draw at a negative offsetConnor Kuehl2022-04-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* aerc: use contextual ui styleset for tabs/composeKoni Marti2022-04-171-4/+10
| | | | | | | | | 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>
* completion: install panic handler in completion callbackRobin Jarry2022-03-251-0/+2
| | | | | | | | | 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>
* logging: added a log on panicMoritz Poldrack2022-03-231-0/+3
| | | | | | | | | | | | | 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>
* lib/ui/textinput: stop at /, ", and ' charsPranjal Kole2022-02-031-5/+11
| | | | This matches the default behaviour of Ctrl+W in vim.
* completions: add support for completing multiple addressesParasrah2022-01-071-5/+6
| | | | | | | 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.
* style: customize vertical and horizontal border charactersDian M Fay2021-11-301-4/+7
| | | | | | | | | 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>
* go.mod: change base git urlRobin Jarry2021-11-054-4/+4
| | | | | | | 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>
* view,compose: use border color to separate headers from bodyRobin Jarry2021-10-281-4/+7
| | | | | | | | | | 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>
* lib/ui/textinput: Optimize ensureScrollAdnan Maolood2021-08-301-5/+5
|
* update tcell to v2 and enable TrueColor supporty0ast2020-12-1811-12/+12
| | | | | | | | | 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.
* Remove unused Simulator interfaceReto Brunner2020-09-101-5/+0
|
* Implement style configuration.Kalyan Sriram2020-08-065-60/+48
| | | | | | 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.
* Revert "Implement style configuration."Reto Brunner2020-07-305-48/+60
| | | | This reverts commit 1ff687ca2b0821c2cacc1fa725abb3302d2af9da.
* Implement style configuration.Kalyan Sriram2020-07-305-60/+48
| | | | | | 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.
* Make grid sizes dynamicJeffas2020-06-091-10/+16
| | | | | | | | | 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.
* Revert "Add Style configuration"Drew DeVault2020-05-285-48/+60
| | | | This reverts commit 0f78f06610c0e8887aba2ae50e99b86477a384b3.
* Add Style configurationReto Brunner2020-05-275-60/+48
| | | | | | | | | | 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
* libui: don't require beeper for main contentDrew DeVault2020-05-051-2/+4
|
* Fix array out of bounds errorburrowing-owl2020-05-051-1/+1
|
* fix: Close unused MessageView when swapping viewRay Ganardi2020-04-201-0/+5
| | | | | | | Closes https://todo.sr.ht/~sircmpwn/aerc2/379 The old `MessageView` was not closed when replacing the tab content, which causes a memory leak.
* Add pinned tabsJeffas2020-03-091-5/+62
| | | | | | 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.
* Initial support for PGP decryption & signaturesDrew DeVault2020-03-032-0/+8
|
* Add move-tab commandJeffas2020-03-031-0/+41
|
* compose: don't call ti.tabcomplete when it is nilTimmy Douglas2020-01-091-0/+4
|
* Don't select completions until tab has been pressedBen Burwell2020-01-051-6/+8
| | | | | | | | | | | | | | | 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.
* Show textinput completions in popoversBen Burwell2019-12-211-50/+223
| | | | | | 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.
* Add popoversBen Burwell2019-12-213-9/+102
| | | | | | | | | | | | 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.
* Add UI options to save/pipe messages with unsupported mimetypesGreg Anders2019-11-171-1/+2
| | | | | | | | | | | | | | | 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.
* Fix tab refocus on removeJeffas2019-10-141-8/+14
| | | | | | | | 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.
* Fix pushing invalid tabs to historyJeffas2019-10-141-1/+4
| | | | A tab can now only be pushed onto the history if it is a selectable tab.
* Focus new tab after removeJeffas2019-09-181-0/+4
| | | | | After removing a tab we should focus the newly selected tab if it is Interactive. This ensures things like the terminal get drawn properly.
* Add MouseableJeffas2019-09-116-24/+164
| | | | | | | | | | | | | | | | | | | | | | 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.
* Add delete forward <C-k> and backward <C-u>Christopher Vittal2019-08-121-0/+29
| | | | | | | | | | 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].
* Remove aerc specific code from the uiNicolai Dagestad2019-08-031-7/+5
| | | | | Separatiing the ui code from aerc makes it usable as a library in other projects.
* Ring bell when new messages arrive0.2.0Ben Burwell2019-07-292-1/+11
| | | | | | | | 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.
* Fix tabstrip over-drawing when not enough spaceJeffas2019-07-261-1/+8
| | | | | | | | 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.
* Add tab completion to textinputsJeffas2019-07-261-10/+74
| | | | | | | | | | | | | 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.
* Fix invalid tab state when deselecting removed tabDrew DeVault2019-07-261-1/+1
|
* Fix :close on terminal panicJeffas2019-07-251-0/+5
| | | | | | | | 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.
* Fix grid creating too large subcontextsJeffas2019-07-251-0/+9
| | | | | | | | 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.
* Fix panic when tabs.popHistory is nonexistentDrew DeVault2019-07-251-1/+1
|
* Add change tab commandJeffas2019-07-231-5/+20
| | | | | | | | | | 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 -
* Display user specified headers in viewer if presentDaniel Bridges2019-07-171-0/+14
|
* Fix grid widths when using weighted widthsJeffas2019-07-171-3/+14
| | | | | | | | | | 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.
* Add MouseEnabled config settingJeffas2019-07-171-1/+3
| | | | | This patch adds the ability to control whether aerc captures mouseevents or not. By default it will be set to not capture events.
* Fix text input cursor position with non-ASCII textTuomas Siipola2019-07-171-3/+3
| | | | Fixes #171
* Add clickable tabsJeffas2019-07-113-0/+36
| | | | | | | | | | | This introduces a new interface `Clickable`. I'd imagine this would be implemented for most widgets eventually and would allow for programs run in the terminal to also have their mouse events forwarded to them. For the tabs it was relatively simple to check that the position of the click is within the boxes for the tabs. For other components I'd imagine that some state representing their currently drawn bounding box would be useful.
* Implement basic tab completion supportGregory Mullen2019-06-291-0/+8
| | | | | Tab completion currently only works on commands. Contextual completion will be added in the future.