aboutsummaryrefslogtreecommitdiffstats
path: root/lib/parse/ansi.go
Commit message (Collapse)AuthorAgeFilesLines
* log: move package to libRobin Jarry2024-02-141-1/+1
| | | | | | | This has nothing to do at the root of the source tree. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Bence Ferdinandy <bence@ferdinandy.com>
* vaxis: update to v0.7.2 and update ansi parserTim Culverhouse2024-02-121-430/+0
| | | | | | | | | | | | Update Vaxis to v0.7.2 to gain performance improvements and StyledString parsing. The Vaxis parser fully accounts for the terminal's capability to display wide characters. Use the Vaxis StyledString parser to parse and style ansi-encoded strings. Remove unneeded code and tests. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* style: use vaxis style everywhereTim Culverhouse2024-02-121-97/+105
| | | | | | | Replace all tcell.Style objects with vaxis.Style objects Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* parse/ansi: remove tcell/terminfo dependencyTim Culverhouse2024-02-121-39/+39
| | | | | | | | | | | | The parse library builds an ansi-escaped string based on a buffer of styled cells. Use constants which aerc will still parse properly (and are the same as the terminfo package was pulling in) to remove dependency on tcell/terminfo. Additionally, we can use the internal go "fmt" package to write strings instead of the terminfo.TParm method (which is much slower at formatting strings). Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* templates: change layered fg & bg color prioritiesRobin Jarry2023-04-151-2/+2
| | | | | | | | | | | | | This is mostly a revert of commit ae4d742c5a90 ("templates: fix layered fg & bg color for inline styles"). As it turns out, context colors (msglist_selected, msglist_marked, msglist_deleted, etc.) need to have priority over inline colors. Otherwise strange and confusing results occur. Reported-by: Skejg <grolleman@zoho.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* templates: fix layered fg & bg color for inline stylesRobin Jarry2023-03-311-7/+8
| | | | | | | | | | | | | The logic was inverted. The style argument is actually the "under" layer style. Each character in the RuneBuffer style must be applied on *top* of it, not the other way around. Use colors from style and override them with each character's colors if they are set. Keep attributes handling unchanged. Fixes: ab8f433e1739 ("templates: allow layered fg & bg color for inline styles") Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* templates: allow layered fg & bg color for inline stylesRobin Jarry2023-03-081-5/+7
| | | | | | | | If a user style has no fg and/or no bg color defined, use the color from the underlying style. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* table: fix center paddingRobin Jarry2023-03-041-3/+24
| | | | | | | | | | | When a column has ALIGN_CENTER and the number of white space character of padding is not a multiple of two, the last cell(character) is not padded and that can cause coloring glitches. Make sure to pad all the way. Fixes: 49de9b09cacc ("ui: parse strings for ansi styles") Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* ui: parse strings for ansi stylesTim Culverhouse2023-03-021-2/+400
| | | | | | | | | Parse UI strings for ANSI styles. If there are styles in the string, use those as the display style in tcell. This is in preparation for a template function which can apply arbitrary styles to UI elements. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* logging: rename package to logRobin Jarry2022-12-021-3/+3
| | | | | | | | | | Use the same name than the builtin "log" package. That way, we do not risk logging in the wrong place. Suggested-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* msgviewer: simplify filter and pager command handlingTim Culverhouse2022-10-181-0/+37
Refactor the filtering and paging logic to use several fewer goroutines. Fixes data race condition with the timing of filter -> pager -> terminal, can be found when switching message views fast. Check if filter -> pager process is currently running before calling it to start again. Fixes data race between fetching message body and terminal starting. Both can initiate the copying process, and for long running filters and fast message fetching, it is possible to have fetched a message but still be running the filter when the terminal starts. Move StripAnsi to it's own file in lib/parse, similar to the hyperlinks parser. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>