Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

feat(device): Focus opens the tab list from the tab, the pane list from the name

0xdiego25c7d9dc1bc812
diff --git a/devices/harness-device/firmware/main/ui/habitat/character_types.h b/devices/harness-device/firmware/main/ui/habitat/character_types.h
index 517096761..1191293d9 100644
--- a/devices/harness-device/firmware/main/ui/habitat/character_types.h
+++ b/devices/harness-device/firmware/main/ui/habitat/character_types.h
@@ -48,6 +48,12 @@ typedef struct {
* WORKING means "an agent is busy" at home and "your words are on their way" here.
*/
bool voice;
+ /*
+ * Whether there is another tab, and another pane in this one, to choose. A skin that draws the
+ * tab and the agent's name as the doors to those lists (Focus) marks them with ⌄ only when
+ * there is somewhere to go: a door to a list of one is an invitation with nothing behind it.
+ */
+ bool more_tabs, more_panes;
uint16_t ink, foreground, dim;
} ht_character_face_t;
diff --git a/devices/harness-device/firmware/main/ui/habitat/focus.c b/devices/harness-device/firmware/main/ui/habitat/focus.c
index d40e72c64..172299d47 100644
--- a/devices/harness-device/firmware/main/ui/habitat/focus.c
+++ b/devices/harness-device/firmware/main/ui/habitat/focus.c
@@ -285,6 +285,35 @@ static const char *meter(unsigned level)
return bars[level > 4 ? 4 : level];
}
+/*
+ * A NAME THAT FITS ITS ROW, or as much of it as fits and "...".
+ *
+ * `cells` is the row's budget in glyphs. A name within it is copied whole; a longer one keeps its
+ * first `cells - 3` glyphs, drops the spaces it would end on, and says so with "..." — so it is never
+ * cut mid-letter by the raster, and never wraps onto a row that is not there. Returns the glyphs used.
+ */
+static int fit(const char *text, int cells, char *out, size_t cap)
+{
+ const char *p = text ? text : "";
+ int glyphs = 0;
+ for (const char *q = p; *q; glyphs++) ht_utf8_next(&q);
+ if (glyphs <= cells) {
+ snprintf(out, cap, "%s", p);
+ return glyphs;
+ }
+ int keep = cells > 3 ? cells - 3 : 0;
+ const char *end = p;
+ for (int i = 0; i < keep && *end; i++) ht_utf8_next(&end);
+ while (end > p && end[-1] == ' ') end--;
+ size_t n = (size_t)(end - p);
+ if (n + 4 > cap) n = cap > 4 ? cap - 4 : 0;
+ memcpy(out, p, n);
+ memcpy(out + n, "...", 4);
+ int used = 0;
+ for (const char *q = out; *q; used++) ht_utf8_next(&q);
+ return used;
+}
+
/*
* THE TAB PILL, as the design draws it: a rounded box with a thin lighter rim.
*
@@ -301,32 +330,32 @@ static const char *meter(unsigned level)
static void pill(ht_scene_t *s, const ht_character_face_t *f, const char *tab)
{
const ht_font_t *font = ROWS[0].font;
- int cells = ROWS[0].width / font->width;
- char line[HT_TEXT_BYTES] = "";
- if (*tab) {
- const char *rest = tab, *end = ht_take_display_line(&rest, cells, font);
- size_t n = (size_t)(end - tab);
- if (n >= sizeof line) n = sizeof line - 1;
- memcpy(line, tab, n);
- line[n] = 0;
- }
- int glyphs = 0;
- for (const char *p = line; *p; glyphs++) ht_utf8_next(&p);
+ // The ⌄ takes two of the name's cells: it is the pill's own width, not an extra on top of it.
+ bool more = f->more_tabs;
+ int down = more ? ht_down_20.width / ht_pill.width : 0;
+ int cells = ROWS[0].width / font->width - down;
+ // 20 glyphs, or 18 beside the ⌄; longer names end in "...".
+ char line[HT_TEXT_BYTES];
+ int glyphs = fit(tab, cells, line, sizeof line);
if (!glyphs) {
ht_text(s, 0, ROWS[0].y, ht_pill.width, &ht_pill, s->background, s->background, "");
ht_text(s, 0, ROWS[0].y, font->width, font, f->foreground, s->background, "");
+ ht_text(s, 0, ROWS[0].y, ht_down_20.width, &ht_down_20, f->dim, s->background, "");
return;
}
char outline[HT_TEXT_BYTES];
int used = snprintf(outline, sizeof outline, "%s", HT_PILL_LEFT);
- for (int i = 0; i < glyphs && used + 4 < (int)sizeof outline - 7; i++)
+ for (int i = 0; i < glyphs + down && used + 4 < (int)sizeof outline - 7; i++)
used += snprintf(outline + used, sizeof outline - (size_t)used, "%s", HT_PILL_BODY);
snprintf(outline + used, sizeof outline - (size_t)used, "%s", HT_PILL_RIGHT);
- int width = (glyphs + 4) * ht_pill.width, x = (HT_WIDTH - width) / 2;
- uint16_t ink = ht_rgb(HT_THEME_PILL);
+ int width = (glyphs + down + 4) * ht_pill.width, x = (HT_WIDTH - width) / 2;
+ uint16_t ink = ht_rgb(HT_THEME_PILL), fill = ht_blend(ink, s->background, 1);
+ int text_x = x + 2 * ht_pill.width;
ht_text(s, x, ROWS[0].y, width, &ht_pill, ink, s->background, outline);
- ht_text(s, x + 2 * ht_pill.width, ROWS[0].y + 4, glyphs * font->width, font, f->foreground,
- ht_blend(ink, s->background, 1), line);
+ ht_text(s, text_x, ROWS[0].y + 4, glyphs * font->width, font, f->foreground, fill, line);
+ // Always emitted — empty, on the pill's own fill, when there is no other tab to choose.
+ ht_text(s, text_x + glyphs * font->width, ROWS[0].y + 4, ht_down_20.width, &ht_down_20,
+ f->dim, fill, more ? HT_DOWN : "");
}
void ht_focus_face(ht_scene_t *s, const ht_character_face_t *f, uint8_t frame, uint16_t ink,
@@ -352,21 +381,27 @@ void ht_focus_face(ht_scene_t *s, const ht_character_face_t *f, uint8_t frame, u
uint32_t mark_ink = 0;
bool badged = ht_focus_engine_mark(f->engine, mark, &mark_ink);
const char *who = f->recipient ? f->recipient : "";
- int cells = 0;
- for (const char *p = who; *p; cells++) ht_utf8_next(&p);
// The badge spends part of the row's chord, so the name gets what is left of it — not the whole
// width it would have had alone. Getting this wrong puts the pair's ends outside the bezel.
- int room = ROWS[1].width - (badged ? ht_engine.width + 8 : 0);
- if (cells * ht_mono_28.width > room) cells = room / ht_mono_28.width;
+ // The ⌄ after the name — "choose another pane" — spends its cell the same way.
+ bool more = f->more_panes && *who;
+ int down = more ? ht_down_28.width : 0;
+ int room = ROWS[1].width - (badged ? ht_engine.width + 8 : 0) - down;
+ // 22 glyphs alone, 20 beside the badge, 18 beside the badge and the ⌄; longer ends in "...".
+ char name[HT_TEXT_BYTES];
+ int cells = fit(who, room / ht_mono_28.width, name, sizeof name);
int name_w = cells * ht_mono_28.width;
- int total = name_w + (badged ? ht_engine.width + 8 : 0);
+ int total = name_w + (badged ? ht_engine.width + 8 : 0) + down;
if (total > ROWS[1].width) total = ROWS[1].width;
int x = (HT_WIDTH - total) / 2;
+ int name_x = x + (badged ? ht_engine.width + 8 : 0);
// Always emitted, badge or not, so the run count and order never move — see the note at the top.
ht_text(s, badged ? x : 0, ROWS[1].y, badged ? ht_engine.width : 1, &ht_engine,
mark_ink ? ht_rgb(mark_ink) : f->foreground, s->background, badged ? mark : "");
- ht_text(s, x + (badged ? ht_engine.width + 8 : 0), ROWS[1].y, name_w ? name_w : 1, &ht_mono_28,
- f->foreground, s->background, who);
+ ht_text(s, name_x, ROWS[1].y, name_w ? name_w : 1, &ht_mono_28,
+ f->foreground, s->background, name);
+ ht_text(s, more ? name_x + name_w : 0, ROWS[1].y, ht_down_28.width, &ht_down_28,
+ f->dim, s->background, more ? HT_DOWN : "");
/*
* The live line.
diff --git a/devices/harness-device/firmware/main/ui/habitat/fonts.c b/devices/harness-device/firmware/main/ui/habitat/fonts.c
index 7d489d3a8..1cee37ead 100644
--- a/devices/harness-device/firmware/main/ui/habitat/fonts.c
+++ b/devices/harness-device/firmware/main/ui/habitat/fonts.c
@@ -6399,6 +6399,33 @@ static const uint8_t ht_chevron_pixels[] = {
1,253,0,7,244,0,31,208,0,127,64,0,253,0,0,116,0,0,0,0,0,0,0,0,
};
const ht_font_t ht_chevron = {57424,57425,12,24,ht_chevron_pixels};
+static const uint8_t ht_down_20_pixels[] = {
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,0,1,128,
+ 0,0,125,0,7,224,0,0,31,64,31,128,0,0,7,208,126,0,0,0,1,245,248,0,
+ 0,0,0,127,224,0,0,0,0,31,128,0,0,0,0,5,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+};
+const ht_font_t ht_down_20 = {57440,57440,24,28,ht_down_20_pixels};
+static const uint8_t ht_down_28_pixels[] = {
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,2,0,0,
+ 0,0,1,244,0,0,184,0,0,0,0,31,208,0,47,64,0,0,0,0,127,64,11,208,
+ 0,0,0,0,1,253,2,244,0,0,0,0,0,7,244,189,0,0,0,0,0,0,31,239,
+ 64,0,0,0,0,0,0,127,208,0,0,0,0,0,0,1,244,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,
+};
+const ht_font_t ht_down_28 = {57440,57440,34,38,ht_down_28_pixels};
static const uint8_t ht_viet_16_pixels[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,44,0,3,208,0,106,0,10,96,0,146,
0,12,36,1,130,128,47,248,2,149,208,96,9,6,0,160,160,6,0,0,0,1,128,0,
diff --git a/devices/harness-device/firmware/main/ui/habitat/terminal.h b/devices/harness-device/firmware/main/ui/habitat/terminal.h
index 816799139..866b39d95 100644
--- a/devices/harness-device/firmware/main/ui/habitat/terminal.h
+++ b/devices/harness-device/firmware/main/ui/habitat/terminal.h
@@ -51,6 +51,9 @@ extern const ht_font_t ht_pill;
extern const ht_font_t ht_chevron;
#define HT_CHEVRON_LEFT "\xee\x81\x90"
#define HT_CHEVRON_RIGHT "\xee\x81\x91"
+// "Choose one" — the ⌄ after the Focus tab pill's name (ht_down_20) and after the agent's (ht_down_28).
+extern const ht_font_t ht_down_20, ht_down_28;
+#define HT_DOWN "\xee\x81\xa0"
// The colour a glyph pixel at coverage `alpha` (0..3) takes between `fg` and `bg`, exactly as the
// rasteriser computes it. For a run that has to sit seamlessly on another run's coverage level.
uint16_t ht_blend(uint16_t fg, uint16_t bg, unsigned alpha);
diff --git a/devices/harness-device/firmware/main/ui/habitat/ui_habitat.c b/devices/harness-device/firmware/main/ui/habitat/ui_habitat.c
index b75363723..ebd83380d 100644
--- a/devices/harness-device/firmware/main/ui/habitat/ui_habitat.c
+++ b/devices/harness-device/firmware/main/ui/habitat/ui_habitat.c
@@ -97,7 +97,7 @@ typedef enum {
A_QUESTION,
A_CHOICE,
A_ANSWER, A_QUESTION_READ, A_QUESTION_CHOICES, A_QUESTION_REVIEW, A_QUESTION_BACK, A_QUESTION_SAY,
- A_PANE_PREV, A_PANE_NEXT,
+ A_PANE_PREV, A_PANE_NEXT, A_TAB_LIST,
A_INBOX,
A_NOTICE,
A_TABS,
@@ -658,7 +658,8 @@ static bool home_footer(action_kind_t action)
// bracket control is pressed and released like every other one, while A_PET reads a TAP as a boop
// and only starts speech on a 650 ms hold — which is the creature's gesture, not a button's.
return action == A_TABS || action == A_INBOX || action == A_AGENTS || action == A_RETURN ||
- action == A_CARRY_DROP || action == A_VOICE || action == A_PANE_PREV || action == A_PANE_NEXT;
+ action == A_CARRY_DROP || action == A_VOICE || action == A_PANE_PREV || action == A_PANE_NEXT ||
+ action == A_TAB_LIST;
}
static bool hit_contains(const hit_t *hit, int x, int y, bool surface)
{
@@ -880,7 +881,8 @@ static void render_home(ht_scene_t *f)
.straight_title = s.straight_title,
.footer_action = carry.active || carry.error[0] || visit.available,
.ink = FG, .foreground = FG, .dim = DIM,
- .primary_title = true, .roomy_reading = true};
+ .primary_title = true, .roomy_reading = true,
+ .more_tabs = s.tab_count > 1, .more_panes = s.count > 1};
char carried[128];
if (carry.active) {
snprintf(carried,sizeof(carried),"%d line%s from %.70s",carry.rows,carry.rows==1?"":"s",carry.source);
@@ -975,10 +977,17 @@ static void render_home(ht_scene_t *f)
}
}
if (!carry.active && !carry.error[0] && !visit.available) {
- // Both phases of the caption open the same pane picker. On Focus the caption is the pill,
- // which sits below where the arc would have been.
- s.hits[s.hit_count++] = focus_face ? (hit_t){{83, 61, 300, 40}, A_AGENTS, 0, true}
- : (hit_t){{83, 0, 300, 66}, A_AGENTS, 0, true};
+ /*
+ * Both phases of the caption open the pane picker on a creature skin. Focus has two doors
+ * where they have one: its tab pill opens the TAB list and its agent's name the PANE list,
+ * each marked ⌄ when there is another to choose (focus.c). The pill's is A_TAB_LIST rather
+ * than A_TABS, because A_TABS on this surface is the slide-to-switch gesture and answers
+ * only a strict tap; a door is pressed and released, like the microphone.
+ */
+ if (focus_face) {
+ s.hits[s.hit_count++] = (hit_t){{83, 61, 300, 40}, A_TAB_LIST, 0, s.connected};
+ s.hits[s.hit_count++] = (hit_t){{83, 118, 300, 48}, A_AGENTS, 0, true};
+ } else s.hits[s.hit_count++] = (hit_t){{83, 0, 300, 66}, A_AGENTS, 0, true};
for (int i = 0; i < f->count; i++) if (f->runs[i].arc == 1) {
ht_rect_t r = ht_run_bounds(&f->runs[i]);
s.caption_arc = (ht_rect_t){r.x - 14, r.y - 14, r.w + 28, r.h + 28};
@@ -1901,6 +1910,7 @@ static void dispatch(action_t a)
}
break;
case A_TABS:
+ case A_TAB_LIST:
tabs_open();
break;
case A_MACHINES:
diff --git a/devices/harness-device/firmware/scripts/gen_habitat_fonts.py b/devices/harness-device/firmware/scripts/gen_habitat_fonts.py
index 95ef6ad52..13e386a76 100644
--- a/devices/harness-device/firmware/scripts/gen_habitat_fonts.py
+++ b/devices/harness-device/firmware/scripts/gen_habitat_fonts.py
@@ -52,6 +52,7 @@ fonts = [('ht_mono_16',mono,16,10,22,17),('ht_mono_20',mono,20,12,28,22),
('ht_wave',mono,40,6,124,40),
('ht_pill',mono,20,12,38,30),
('ht_chevron',mono,20,12,24,20),
+ ('ht_down_20',mono,20,24,28,22),('ht_down_28',mono,28,34,38,31),
('ht_viet_16',viet,16,10,22,17),('ht_viet_20',viet,20,12,28,22),
('ht_viet_24',viet,24,15,32,26),('ht_viet_28',viet,28,17,38,31)]
with dest.open('w') as out:
@@ -62,7 +63,7 @@ with dest.open('w') as out:
data=[]
bounds=[]
# Latin-1 keeps common names readable; unknown Unicode renders ?, never changes wire text.
- first,last=(0xe020,0xe020+len(ENGINES)-1) if name=='ht_engine' else (0xe010,0xe01f) if name=='ht_wave' else (0xe040,0xe044) if name=='ht_pill' else (0xe050,0xe051) if name=='ht_chevron' else (0xe002,0xe002) if name=='ht_spark' else (0xe001,0xe001) if name=='ht_mic_footer' else (0x1ea0,0x1ea0+0x59+len(VIET_TAIL)) if name.startswith('ht_viet_') else (0xe000,0xe000) if name.startswith('ht_bell_') else (0x2713,0x2713) if name=='ht_done_28' else (0x2717,0x2717) if name=='ht_failed_28' else (0x2190,0x2197) if name=='ht_nav_32' else (0x2197,0x2197) if name.startswith('ht_open_') else (0x2192,0x2192) if name.startswith('ht_right_') else (ord('o'),ord('o')) if name=='ht_lock_dot' else (32,255 if name!='ht_pixel_40' else 126)
+ first,last=(0xe020,0xe020+len(ENGINES)-1) if name=='ht_engine' else (0xe010,0xe01f) if name=='ht_wave' else (0xe040,0xe044) if name=='ht_pill' else (0xe050,0xe051) if name=='ht_chevron' else (0xe060,0xe060) if name.startswith('ht_down_') else (0xe002,0xe002) if name=='ht_spark' else (0xe001,0xe001) if name=='ht_mic_footer' else (0x1ea0,0x1ea0+0x59+len(VIET_TAIL)) if name.startswith('ht_viet_') else (0xe000,0xe000) if name.startswith('ht_bell_') else (0x2713,0x2713) if name=='ht_done_28' else (0x2717,0x2717) if name=='ht_failed_28' else (0x2190,0x2197) if name=='ht_nav_32' else (0x2197,0x2197) if name.startswith('ht_open_') else (0x2192,0x2192) if name.startswith('ht_right_') else (ord('o'),ord('o')) if name=='ht_lock_dot' else (32,255 if name!='ht_pixel_40' else 126)
for cp in range(first,last+1):
# The tail of the Vietnamese atlas is the eight scattered letters, in VIET_TAIL order.
glyph = VIET_TAIL[cp-0x1efa] if name.startswith('ht_viet_') and cp >= 0x1efa else chr(cp)
@@ -165,6 +166,19 @@ with dest.open('w') as out:
radius=height*S//2 - S, fill=85)
x = piece * width * S
im = big.crop((x, 0, x + width*S, height*S)).resize((width, height), Image.Resampling.BOX)
+ elif name.startswith('ht_down_'):
+ # "CHOOSE ONE": the ⌄ after the Focus tab pill's name and after the agent's name, each
+ # opening its own list — tabs and panes. One sign for both, so it is learnt once.
+ # Drawn, at 4x and reduced; sized to sit on the cap line of the text it follows.
+ S = 4
+ big = Image.new('L', (width*S, height*S))
+ d = ImageDraw.Draw(big)
+ if name == 'ht_down_20':
+ pts, stroke = [(9, 11.5), (15, 17.5), (21, 11.5)], 2.0
+ else:
+ pts, stroke = [(10, 17), (17, 24), (24, 17)], 2.2
+ d.line([(x*S, y*S) for x, y in pts], fill=255, width=round(stroke*S), joint='curve')
+ im = big.resize((width, height), Image.Resampling.BOX)
elif name=='ht_chevron':
# The Focus pane arrows, the design's own at 1:1 like the microphone: 11 x 20 of
# #8a8a99 on black, from "Agent — recap". See assets/README.md.
diff --git a/devices/harness-device/firmware/test/test_character.c b/devices/harness-device/firmware/test/test_character.c
index 1c803d250..85bd77962 100644
--- a/devices/harness-device/firmware/test/test_character.c
+++ b/devices/harness-device/firmware/test/test_character.c
@@ -259,10 +259,14 @@ static void focus_face(void)
"L\u01b0\u1ee3ng b\u1ed9 nh\u1edb \u0111\u00e3 gi\u1ea3m v\u00e0 ki\u1ec3m tra l\u1ea1i.", HT_CHARACTER_IDLE, 0, 0},
};
int expected = -1;
- for (unsigned i = 0; i < sizeof cases / sizeof cases[0]; i++) {
+ // Every case twice: with the ⌄ doors and without. Same runs either way, and the longest names
+ // with a ⌄ after them are the ones that would reach the bezel if its cell were not budgeted.
+ for (unsigned k = 0; k < 2 * (sizeof cases / sizeof cases[0]); k++) {
+ unsigned i = k / 2;
ht_character_face_t f = {.recipient = cases[i].name, .tab = cases[i].tab,
.engine = cases[i].engine, .activity = cases[i].activity, .elapsed = cases[i].elapsed,
.status = "", .hint = "", .detail = "", .mood = cases[i].mood,
+ .more_tabs = k & 1, .more_panes = k & 1,
.foreground = 0xffff, .dim = 0x8410, .ink = 0xffff};
f.pose.level = cases[i].level;
ht_scene_t scene; ht_scene_clear(&scene, 0);
@@ -274,6 +278,31 @@ static void focus_face(void)
if (full[y * HT_WIDTH + x])
assert((x - 233) * (x - 233) + (y - 233) * (y - 233) < 230 * 230); // property 2
}
+ /*
+ * A NAME TOO LONG FOR ITS ROW ends in "...", within its budget: the pill holds 20 glyphs (18
+ * beside its ⌄), the agent's row 20 beside the badge (18 beside the badge and the ⌄). Cut by
+ * the raster instead, it reads as a typo — "Deploy latest firmwa" — and the eye stops on it.
+ */
+ for (int more = 0; more < 2; more++) {
+ ht_character_face_t f = {.recipient = long_name, .tab = long_tab, .engine = "claude",
+ .activity = "", .status = "", .hint = "", .detail = "", .mood = HT_CHARACTER_IDLE,
+ .more_tabs = more, .more_panes = more, .foreground = 0xffff, .dim = 0x8410, .ink = 0xffff};
+ ht_scene_t scene; ht_scene_clear(&scene, 0);
+ ht_character_face(&scene, &c, &f, 0xffff, "");
+ int found = 0;
+ for (int i = 0; i < scene.count; i++) {
+ const ht_run_t *r = &scene.runs[i];
+ size_t n = strlen(r->text);
+ if (n < 3 || strcmp(r->text + n - 3, "...")) continue;
+ int glyphs = 0;
+ for (const char *p = r->text; *p; glyphs++) ht_utf8_next(&p);
+ if (r->font == &ht_mono_20) { assert(glyphs == (more ? 18 : 20)); found |= 1; }
+ if (r->font == &ht_mono_28) { assert(glyphs == (more ? 18 : 20)); found |= 2; }
+ assert(r->w >= glyphs * r->font->width); // the raster never cuts it
+ }
+ assert(found == 3);
+ }
+
/*
* THE VOICE FACE, both halves of it, every frame.
*
@@ -334,10 +363,11 @@ static void focus_face(void)
assert(above == below);
}
- // Stated as its parts rather than as a number: the tab pill and the two rows of padding under it,
- // the agent name, the engine mark on its own run so it can be coloured without a per-cell
- // palette, the live status, and the four recap rows the octopus reads its summary in.
- assert(expected == 1 + 1 + 1 + 1 + 1 + 4);
+ // Stated as its parts rather than as a number: the tab pill (its outline, its name and the ⌄
+ // after it), the agent's row (the engine mark on its own run so it can be coloured without a
+ // per-cell palette, the name, and its ⌄), the live status, and the four recap rows the octopus
+ // reads its summary in. The two ⌄ runs are emitted empty when there is nothing else to choose.
+ assert(expected == 3 + 3 + 1 + 4);
}
static void footer_layout(void)
diff --git a/devices/harness-device/firmware/test/test_touch_ui.py b/devices/harness-device/firmware/test/test_touch_ui.py
index aa55431ec..dd2665473 100644
--- a/devices/harness-device/firmware/test/test_touch_ui.py
+++ b/devices/harness-device/firmware/test/test_touch_ui.py
@@ -243,6 +243,7 @@ static void dispatch(action_t a) {
else if (a.kind == A_VOICE_ABORT) { recording = s.voice_open = false; view(HOME); }
else if (a.kind == A_RETURN || a.kind == A_LATEST) { if(a.kind==A_RETURN)returns++; visit_action(a); }
else if (a.kind == A_PET) boops++;
+ else if (a.kind == A_TAB_LIST) tabs_open(); // mirrors ui_habitat.c's dispatch
else if (a.kind == A_PANE_PREV || a.kind == A_PANE_NEXT) { // mirrors ui_habitat.c's dispatch
int i = s.active < 0 ? 0 : (s.active + (a.kind == A_PANE_NEXT ? 1 : s.count - 1)) % s.count;
action_t pane = {.kind = A_AGENT}; COPY(pane.id, s.agents[i].id); dispatch(pane);
@@ -1744,6 +1745,28 @@ int main(int argc, char **argv) {
// The Focus SKIN's home face, footer and all — the "focus" portrait above is the legacy
// focus-face option on the default character, which draws no microphone.
reset(); ht_character_select(&character, HT_CHARACTER_FOCUS); scene_take(); portrait(dir, "focus-skin");
+ // THE TWO DOORS on Focus: the tab pill opens the tab list, the agent's name the pane list —
+ // pressed and released like the microphone, so a thumb that drifts or lingers still opens them.
+ workspace_setup(); ht_character_select(&character, HT_CHARACTER_FOCUS); scene_take();
+ tap(1000, 233, 80); assert(s.view == TABS);
+ workspace_setup(); ht_character_select(&character, HT_CHARACTER_FOCUS); scene_take();
+ tap(1000, 233, 142); assert(s.view == AGENTS && !starts);
+ workspace_setup(); ht_character_select(&character, HT_CHARACTER_FOCUS); scene_take();
+ habitat_touch(true, 233, 80, 1000); habitat_touch(true, 247, 90, 1400); habitat_touch(false, 247, 90, 1900);
+ assert(s.view == TABS);
+ workspace_setup(); ht_character_select(&character, HT_CHARACTER_FOCUS); scene_take();
+ habitat_touch(true, 233, 142, 1000); habitat_touch(true, 247, 152, 1400); habitat_touch(false, 247, 152, 1900);
+ assert(s.view == AGENTS);
+ // ⌄ marks each door only when there is another to choose.
+ {
+ workspace_setup(); ht_character_select(&character, HT_CHARACTER_FOCUS); scene_take();
+ int downs = 0;
+ for (int i = 0; i < scene.count; i++) if (!strcmp(scene.runs[i].text, HT_DOWN)) downs++;
+ assert(downs == 2); // four tabs, two panes
+ s.tab_count = 1; s.count = 1; scene_take(); downs = 0;
+ for (int i = 0; i < scene.count; i++) if (!strcmp(scene.runs[i].text, HT_DOWN)) downs++;
+ assert(downs == 0);
+ }
// THE PANE ARROWS either side of the Focus microphone: a sideways swipe, as buttons, and only when
// the tab has another agent to go to.
reset(); ht_character_select(&character, HT_CHARACTER_FOCUS); scene_take(); portrait(dir, "focus-arrows");