@@ -330,6 +330,9 @@ function update_demonstrations(secondary)
330330 -- [l tool] [c tool] [r tool] (bottom of UI)
331331 local toolbar_demo_dy = - TOOLBAR_HEIGHT
332332 local ir = gui .get_interface_rect ()
333+ --- @param v widgets.Panel
334+ --- @param frame widgets.Widget.frame
335+ --- @param buttons NamedButtons
333336 local function update (v , frame , buttons )
334337 v .frame = {
335338 w = frame .w ,
@@ -338,15 +341,19 @@ function update_demonstrations(secondary)
338341 t = frame .t + ir .y1 + toolbar_demo_dy ,
339342 }
340343 local sorted = {}
341- for _ , offset in pairs (buttons ) do
342- utils .insert_sorted (sorted , offset )
344+ for _ , button in pairs (buttons ) do
345+ utils .insert_sorted (sorted , button , ' offset' )
343346 end
344347 local buttons = ' '
345348 for i , o in ipairs (sorted ) do
346- if o > # buttons then
347- buttons = buttons .. (' ' ):rep (o - # buttons )
349+ if o .offset > # buttons then
350+ buttons = buttons .. (' ' ):rep (o .offset - # buttons )
351+ end
352+ if o .width == 1 then
353+ buttons = buttons .. ' |'
354+ elseif o .width > 1 then
355+ buttons = buttons .. ' /' .. (' -' ):rep (o .width - 2 ).. ' \\ '
348356 end
349- buttons = buttons .. ' /--\\ '
350357 end
351358 v .subviews .buttons :setText (
352359 buttons :sub (2 ) -- the demo panel border is at offset 0, so trim first character to start at offset 1
@@ -360,16 +367,16 @@ function update_demonstrations(secondary)
360367 -- [s tool]
361368 -- [l tool] [c tool] [r tool] (bottom of UI)
362369 update (secondary_toolbar_demo , fort .center :secondary_toolbar_frame (ir , secondary ),
363- fort .center .secondary_toolbars [secondary ].button_offsets )
370+ fort .center .secondary_toolbars [secondary ].buttons )
364371 secondary_visible = true
365372 toolbar_demo_dy = toolbar_demo_dy - 2 * SECONDARY_TOOLBAR_HEIGHT
366373 else
367374 secondary_visible = false
368375 end
369376
370- update (left_toolbar_demo , fort .left :frame (ir ), fort .left .button_offsets )
371- update (right_toolbar_demo , fort .right :frame (ir ), fort .right .button_offsets )
372- update (center_toolbar_demo , fort .center :frame (ir ), fort .center .button_offsets )
377+ update (left_toolbar_demo , fort .left :frame (ir ), fort .left .buttons )
378+ update (right_toolbar_demo , fort .right :frame (ir ), fort .right .buttons )
379+ update (center_toolbar_demo , fort .center :frame (ir ), fort .center .buttons )
373380end
374381
375382local tool_from_designation = {
0 commit comments