summaryrefslogtreecommitdiff
path: root/ui.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-30 14:57:26 -0500
committerpommicket <pommicket@gmail.com>2022-12-30 14:57:26 -0500
commit547bfbba7a1ef84d397711882a501fc4914addba (patch)
treefd702946ac77db0c828e871f4ad90ae6fe99198b /ui.c
parentf2c8a3a77fdd7f397e04edcaf5dae5e7777f03b6 (diff)
show location in definitions menu
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/ui.c b/ui.c
index 94648f8..ebaa0ef 100644
--- a/ui.c
+++ b/ui.c
@@ -111,9 +111,10 @@ static char *selector_update(Ted *ted, Selector *s) {
// NOTE: also renders the line buffer
static void selector_render(Ted *ted, Selector *s) {
- Settings const *settings = ted_active_settings(ted);
- u32 const *colors = settings->colors;
+ const Settings *settings = ted_active_settings(ted);
+ const u32 *colors = settings->colors;
Font *font = ted->font;
+ float padding = settings->padding;
Rect bounds = s->bounds;
@@ -149,10 +150,23 @@ static void selector_render(Ted *ted, Selector *s) {
for (u32 i = 0; i < s->n_entries; ++i) {
Rect r;
if (selector_entry_pos(ted, s, i, &r)) {
+ SelectorEntry *entry = &entries[i];
float x = r.pos.x, y = r.pos.y;
text_state.x = x; text_state.y = y;
- rgba_u32_to_floats(entries[i].color, text_state.color);
- text_utf8_with_state(font, &text_state, entries[i].name);
+
+ // draw name
+ rgba_u32_to_floats(entry->color, text_state.color);
+ text_utf8_with_state(font, &text_state, entry->name);
+
+ if (entry->detail) {
+ // draw detail
+ float detail_size = text_get_size_v2(font, entry->detail).x;
+ TextRenderState detail_state = text_state;
+ detail_state.x = maxd(text_state.x + 2 * padding, x2 - detail_size);
+
+ rgba_u32_to_floats(colors[COLOR_COMMENT], detail_state.color);
+ text_utf8_with_state(font, &detail_state, entry->detail);
+ }
}
}
text_render(font);