Commit Graph

32 Commits

Author SHA1 Message Date
y0ast 03650474e2 update tcell to v2 and enable TrueColor support
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-12-18 07:23:22 +01:00
Kalyan Sriram 905cb9dfd3 Implement style configuration.
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-08-06 21:42:06 +02:00
Reto Brunner 3d784c5d8c Revert "Implement style configuration."
This reverts commit 1ff687ca2b.
2020-07-30 23:22:32 +02:00
Kalyan Sriram 1ff687ca2b Implement style configuration.
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-30 19:35:59 +02:00
Drew DeVault caad1b2c06 Revert "Add Style configuration"
This reverts commit 0f78f06610.
2020-05-28 10:32:42 -04:00
Reto Brunner 0f78f06610 Add Style configuration
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-27 07:57:10 +02:00
Ray Ganardi 5b751b6d6d fix: Close unused MessageView when swapping view
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-04-20 10:48:40 -04:00
Jeffas 3156d481fe Add pinned tabs
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-09 09:31:02 -04:00
Jeffas 68f179021d Add move-tab command 2020-03-03 20:08:29 +01:00
Jeffas 03d182ca88 Fix tab refocus on remove
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-14 10:38:04 -04:00
Jeffas 2542c65af2 Fix pushing invalid tabs to history
A tab can now only be pushed onto the history if it is a selectable tab.
2019-10-14 10:38:02 -04:00
Jeffas 0ce1d42bda Focus new tab after remove
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-18 19:20:49 -04:00
Jeffas f6216bb621 Add Mouseable
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-09-11 11:41:34 -04:00
Jeffas 7a3765a36b Fix tabstrip over-drawing when not enough space
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-26 15:12:24 -04:00
Drew DeVault aabe3d9b3a Fix invalid tab state when deselecting removed tab 2019-07-26 14:37:45 -04:00
Jeffas ee5b537d53 Fix :close on terminal panic
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-25 18:12:08 -04:00
Drew DeVault 2f626ddd18 Fix panic when tabs.popHistory is nonexistent 2019-07-25 08:29:10 -04:00
Jeffas e42b95a617 Add change tab command
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-23 10:27:59 -04:00
Jeffas 3b09c07e7a Add clickable tabs
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.
2019-07-11 19:45:53 -04:00
Kevin Kuehler a54f4adb8f lib/ui/tab: Add Replace method
Also expose a light wrapper method in aerc.go for tab replacement

Signed-off-by: Kevin Kuehler <kkuehler@brave.com>
2019-06-11 09:34:45 -04:00
Drew DeVault 207ecc39cd Fix #116 2019-06-03 07:56:08 -04:00
Reto Brunner 92b10fcef5 Add Tabs history
Fixes #77: When closing a tab, bring you back to the one you last had focused
2019-06-02 14:22:04 -04:00
Drew DeVault 2c486cb7f5 Update tab name as subject changes
Also moves truncation to the tab widget
2019-05-14 16:18:59 -04:00
Drew DeVault 84965d680c Use tcell.Style.Reverse instead of black on white 2019-03-30 12:59:18 -04:00
Drew DeVault dee0f8938b Add :term-close 2019-03-17 17:23:53 -04:00
Drew DeVault 589db742cb Move exline handling up to aerc, add :term 2019-03-17 16:19:15 -04:00
Drew DeVault a0c2b1caf0 Implement the Container interface in lib/ui/ 2019-01-20 15:06:44 -05:00
Markus Ongyerth 2f5c1db63c refactor lib/ui/tab to ensure staying in bounds
Fix a few potential out of bounds by placing proper checks, which should
be relevant if all tabs are removed for some reason.

Also avoid iterating all tabs in the invalidate handler, since we are
only interested in whether it's the selected tab either way
2018-06-13 07:00:12 -04:00
Drew DeVault dc90be24de Fix tab invalidation bugs 2018-06-11 20:13:02 -04:00
Drew DeVault e463c38476 Use default color for selected tab 2018-06-07 13:43:17 -04:00
Markus Ongyerth 80e891a802 switch to tcell from termbox
This is a simple mostly straight forward switch to tcell in favor of
termbox.
It uses the tcell native api (not the compat layer) but does not make
use of most features.

Further changes should include moving to tcell's views.TextArea and the
general built in widget behaviour instead of the current ad hoc
implementation.

Regression: Cursor isn't shown in ex-line
2018-06-01 16:04:43 -07:00
Drew DeVault 1418e1b9dc Split UI library and widgets 2018-02-26 22:54:39 -05:00
Renamed from ui/tab.go (Browse further)