csi: wip: styled underlines

This is work in progress, and fairly untested.

This adds initial tracking of styled underlines. Setting attributes
seems to work (both color and underline style). Grid reflow has *not*
been tested.

When rendering, style is currently ignored (all styles are rendered as
a plain, legacy underline).

Color however, *is* applied.
This commit is contained in:
Daniel Eklöf 2024-06-23 17:39:15 +02:00
parent 20923bb2e8
commit 32effc6657
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
6 changed files with 371 additions and 66 deletions

15
grid.h
View file

@ -88,17 +88,27 @@ void grid_row_uri_range_put(
struct row *row, int col, const char *uri, uint64_t id);
void grid_row_uri_range_erase(struct row *row, int start, int end);
void grid_row_curly_range_put(
struct row *row, int col, struct curly_range_data data);
void grid_row_curly_range_erase(struct row *row, int start, int end);
static inline void
grid_row_uri_range_destroy(struct row_range *range)
{
free(range->uri.uri);
}
static inline void
grid_row_curly_range_destroy(struct row_range *range)
{
}
static inline void
grid_row_range_destroy(struct row_range *range, enum row_range_type type)
{
switch (type) {
case ROW_RANGE_URI: grid_row_uri_range_destroy(range); break;
case ROW_RANGE_CURLY: grid_row_curly_range_destroy(range); break;
}
}
@ -118,9 +128,10 @@ grid_row_reset_extra(struct row *row)
if (likely(extra == NULL))
return;
for (size_t i = 0; i < extra->uri_ranges.count; i++)
grid_row_uri_range_destroy(&extra->uri_ranges.v[i]);
grid_row_ranges_destroy(&extra->uri_ranges, ROW_RANGE_URI);
grid_row_ranges_destroy(&extra->curly_ranges, ROW_RANGE_CURLY);
free(extra->uri_ranges.v);
free(extra->curly_ranges.v);
free(extra);
row->extra = NULL;