Toolbar: no cap on pinned buttons (Fixes #323) (#326)

* Toolbar: no cap on pinned buttons (Fixes #323)

Every pinned command gets a toolbar button; `promoted()` is only the
default layout of a fresh or reset toolbar. A toolbar too narrow for every
button now collapses panels into their drop-down (one button that opens it,
listing every command, pinned ones included) from the right, then moves the
last panels into the » menu, instead of pushing a wide panel and everything
after it into ». Nothing is dropped.

Scenario s48 pins ten commands into SOLID > CREATE: all ten show at a wide
window, a narrow one collapses CREATE into its drop-down (all ten listed),
narrower still puts it in », and Reset Toolbar restores the defaults.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RjGw4gA5ZvKrU8MQP6sBgT

* Narrow-toolbar test: panels collapse into their drop-down before »

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RjGw4gA5ZvKrU8MQP6sBgT

* kernel: drop a needless borrow that fails clippy -D warnings on the current stable

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RjGw4gA5ZvKrU8MQP6sBgT

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bherbruckandClaude Opus 5.5 authored and GitHub committed 2026-10-12 12:35:19 -04:00
1 parent 354a267830
commit 198f45edee
4 files changed
+577 -19

No files matched your search

+8 -1
View File
@@ -118,8 +118,15 @@ fn narrow_toolbar_reaches_collapsed_commands() {
use serde_json::json;
let mut h = Harness::new();
h.run(&json!([
// Too narrow for every button: the last panels collapse into their drop-down.
{"call":"ui.resize","params":{"width":640,"height":800}},
{"expect":{"shown_handles":["toolbar:overflow"]}},
{"expect":{"shown_handles":["collapsed:SOLID:CONSTRUCT"],"hidden_handles":["button:construct.plane.offset"]}},
{"click":{"handle":"collapsed:SOLID:CONSTRUCT"}},
{"expect":{"shown_handles":["dropdown:construct.plane.offset"]}},
{"key":"Escape"},
// Narrower: they go into the » menu.
{"call":"ui.resize","params":{"width":480,"height":800}},
{"expect":{"shown_handles":["toolbar:overflow"],"hidden_handles":["collapsed:SOLID:CONSTRUCT"]}},
{"click":{"handle":"toolbar:overflow"}},
{"widget":"CONSTRUCT"},
{"expect":{"shown_handles":["toolbar:construct.plane.offset"]}},
@@ -0,0 +1,427 @@
[
{
"note": "#323: every pinned command gets a toolbar button, with no fixed cap. Ten commands pinned to SOLID > CREATE all show as buttons at a wide window; at a narrow one the panel collapses into its drop-down, then into the » menu, and none is dropped."
},
{
"call": "ui.resize",
"params": {
"width": 2000,
"height": 1000
}
},
{
"expect": {
"hidden_handles": [
"button:solid.box",
"button:solid.cylinder",
"button:solid.sphere",
"button:solid.torus",
"button:solid.coil",
"button:solid.loft",
"button:solid.mirror",
"button:solid.hole",
"button:solid.pipe",
"button:solid.thread"
]
}
},
{
"call": "ui.menu",
"params": {
"x": 300,
"y": 60,
"target": {
"type": "toolbar_command",
"id": "solid.box"
}
}
},
{
"call": "ui.menuPick",
"params": {
"item": "Pin to Toolbar"
}
},
{
"call": "ui.menu",
"params": {
"x": 300,
"y": 60,
"target": {
"type": "toolbar_command",
"id": "solid.cylinder"
}
}
},
{
"call": "ui.menuPick",
"params": {
"item": "Pin to Toolbar"
}
},
{
"call": "ui.menu",
"params": {
"x": 300,
"y": 60,
"target": {
"type": "toolbar_command",
"id": "solid.sphere"
}
}
},
{
"call": "ui.menuPick",
"params": {
"item": "Pin to Toolbar"
}
},
{
"call": "ui.menu",
"params": {
"x": 300,
"y": 60,
"target": {
"type": "toolbar_command",
"id": "solid.torus"
}
}
},
{
"call": "ui.menuPick",
"params": {
"item": "Pin to Toolbar"
}
},
{
"call": "ui.menu",
"params": {
"x": 300,
"y": 60,
"target": {
"type": "toolbar_command",
"id": "solid.coil"
}
}
},
{
"call": "ui.menuPick",
"params": {
"item": "Pin to Toolbar"
}
},
{
"call": "ui.menu",
"params": {
"x": 300,
"y": 60,
"target": {
"type": "toolbar_command",
"id": "solid.loft"
}
}
},
{
"call": "ui.menuPick",
"params": {
"item": "Pin to Toolbar"
}
},
{
"call": "ui.menu",
"params": {
"x": 300,
"y": 60,
"target": {
"type": "toolbar_command",
"id": "solid.mirror"
}
}
},
{
"call": "ui.menuPick",
"params": {
"item": "Pin to Toolbar"
}
},
{
"call": "ui.menu",
"params": {
"x": 300,
"y": 60,
"target": {
"type": "toolbar_command",
"id": "solid.hole"
}
}
},
{
"call": "ui.menuPick",
"params": {
"item": "Pin to Toolbar"
}
},
{
"call": "ui.menu",
"params": {
"x": 300,
"y": 60,
"target": {
"type": "toolbar_command",
"id": "solid.pipe"
}
}
},
{
"call": "ui.menuPick",
"params": {
"item": "Pin to Toolbar"
}
},
{
"call": "ui.menu",
"params": {
"x": 300,
"y": 60,
"target": {
"type": "toolbar_command",
"id": "solid.thread"
}
}
},
{
"call": "ui.menuPick",
"params": {
"item": "Pin to Toolbar"
}
},
{
"expect": {
"shown_handles": [
"button:solid.box",
"button:solid.cylinder",
"button:solid.sphere",
"button:solid.torus",
"button:solid.coil",
"button:solid.loft",
"button:solid.mirror",
"button:solid.hole",
"button:solid.pipe",
"button:solid.thread"
],
"handle_order": [
"button:solid.extrude",
"button:solid.box",
"button:solid.cylinder",
"button:solid.sphere",
"button:solid.torus",
"button:solid.coil",
"button:solid.loft",
"button:solid.mirror",
"button:solid.hole",
"button:solid.pipe",
"button:solid.thread"
],
"count": {
"name": "toolbar_collapsed",
"value": 0
}
}
},
{
"note": "A narrow window: CREATE collapses into one button that opens its drop-down, which lists every pinned command."
},
{
"call": "ui.resize",
"params": {
"width": 900,
"height": 800
}
},
{
"expect": {
"hidden_handles": [
"button:solid.box",
"button:solid.cylinder",
"button:solid.sphere",
"button:solid.torus",
"button:solid.coil",
"button:solid.loft",
"button:solid.mirror",
"button:solid.hole",
"button:solid.pipe",
"button:solid.thread"
],
"shown_handles": [
"collapsed:SOLID:CREATE",
"panel:SOLID:CREATE"
]
}
},
{
"click": {
"handle": "collapsed:SOLID:CREATE"
}
},
{
"expect": {
"shown_handles": [
"dropdown:solid.box",
"dropdown:solid.cylinder",
"dropdown:solid.sphere",
"dropdown:solid.torus",
"dropdown:solid.coil",
"dropdown:solid.loft",
"dropdown:solid.mirror",
"dropdown:solid.hole",
"dropdown:solid.pipe",
"dropdown:solid.thread"
]
}
},
{
"key": "Escape"
},
{
"expect": {
"hidden_handles": [
"dropdown:solid.box",
"dropdown:solid.cylinder",
"dropdown:solid.sphere",
"dropdown:solid.torus",
"dropdown:solid.coil",
"dropdown:solid.loft",
"dropdown:solid.mirror",
"dropdown:solid.hole",
"dropdown:solid.pipe",
"dropdown:solid.thread"
]
}
},
{
"note": "Narrower still: the panels move into the » menu, and CREATE's submenu has every command."
},
{
"call": "ui.resize",
"params": {
"width": 200,
"height": 800
}
},
{
"expect": {
"hidden_handles": [
"panel:SOLID:CREATE",
"collapsed:SOLID:CREATE",
"button:solid.box",
"button:solid.cylinder",
"button:solid.sphere",
"button:solid.torus",
"button:solid.coil",
"button:solid.loft",
"button:solid.mirror",
"button:solid.hole",
"button:solid.pipe",
"button:solid.thread"
],
"shown_handles": [
"toolbar:overflow"
]
}
},
{
"click": {
"handle": "toolbar:overflow"
}
},
{
"widget": "CREATE"
},
{
"expect": {
"shown_handles": [
"toolbar:solid.box",
"toolbar:solid.cylinder",
"toolbar:solid.sphere",
"toolbar:solid.torus",
"toolbar:solid.coil",
"toolbar:solid.loft",
"toolbar:solid.mirror",
"toolbar:solid.hole",
"toolbar:solid.pipe",
"toolbar:solid.thread"
]
}
},
{
"key": "Escape"
},
{
"key": "Escape"
},
{
"note": "Wide again: all ten buttons are back; Reset Toolbar puts the defaults back."
},
{
"call": "ui.resize",
"params": {
"width": 2000,
"height": 1000
}
},
{
"expect": {
"shown_handles": [
"button:solid.box",
"button:solid.cylinder",
"button:solid.sphere",
"button:solid.torus",
"button:solid.coil",
"button:solid.loft",
"button:solid.mirror",
"button:solid.hole",
"button:solid.pipe",
"button:solid.thread"
],
"count": {
"name": "toolbar_more",
"value": 0
}
}
},
{
"call": "ui.menu",
"params": {
"x": 1900,
"y": 60,
"target": {
"type": "toolbar"
}
}
},
{
"call": "ui.menuPick",
"params": {
"item": "Reset Toolbar"
}
},
{
"expect": {
"hidden_handles": [
"button:solid.box",
"button:solid.cylinder",
"button:solid.sphere",
"button:solid.torus",
"button:solid.coil",
"button:solid.loft",
"button:solid.mirror",
"button:solid.hole",
"button:solid.pipe",
"button:solid.thread"
],
"shown_handles": [
"button:solid.extrude"
]
}
}
]