"same" unexpected behavior vs traditional pic
(1) By Michael Thornburgh (zenomt) on 2023-08-12 18:21:27 [link] [source]
it looks like in some contexts, same
on at least a box unexpectedly (and i think improperly) overrides the layout direction.
example:
arrow right box width 2*boxht "Start" arrow box same "Right" move to 1st box.s down arrow box same "Down" arrow box same "More Down?"→ /pikchrshow
note that if the same
is removed from box same "Down"
that the picture is laid out as expected (but the utility of same
is lost):
arrow right box width 2*boxht "Start" arrow box same "Right" move to 1st box.s down arrow box "Down" arrow box same "More Down?"→ /pikchrshow
and finally, if instead of "move to 1st box.s; down, arrow
" i say "down; arrow from 1st box.s
", the layout is correct with same
after the "Down" box:
arrow right box width 2*boxht "Start" arrow box same "Right" down arrow from 1st box.s box same "Down" arrow box same "More Down?"→ /pikchrshow
i think the overall layout direction is sticking to the "Right" box, and is still right
when the move to 1st box.s
happens, but when the layout is changed to down
immediately after the "Right" box, that's what sticks. however, it's unexpected that the overall layout direction would be changed when same
is applied to a block object.
for comparison with traditional Pic, here is the original input at the top as rendered by svgpic(1)
from Plan 9 (GNU Pic does the same thing), included inline as a data
IMG tag (works in preview, hopefully also once i submit; inline SVG markup wasn't allowed):
(2) By Michael Thornburgh (zenomt) on 2023-08-12 18:33:04 in reply to 1 [source]
i think retention and re-application of the layout direction with same
on a block object is improper because if you try to specify a direction on a box you get an error:
/* 1 */ arrow right
/* 2 */ box width 2*boxht "Start"
/* 3 */ arrow
/* 4 */ box same "Right"
/* 5 */ arrow down from 1st box.s
/* 6 */ box down same "Down"
^^^^
ERROR: use with line-oriented objects only
(in other words, the layout direction should stick to "line-oriented objects", not block objects, for purposes of same
)
(3) By drh on 2023-08-12 19:29:18 in reply to 1 [link] [source]
Should now be fixed on trunk. Fossil was also recompiled, so the initial post now gives the expected result.
For historical completeness, the first pikchr drawing in the initial post looked like the following prior to the bug fix:
arrow right box width 2*boxht "Start" arrow box same "Right" move to 1st box.s down arrow box same "Down" right arrow box same "More Down?"→ /pikchrshow
(4) By Michael Thornburgh (zenomt) on 2023-08-12 21:54:58 in reply to 3 [link] [source]
excellent, thanks. i see the fix is my favorite kind, consisting entirely of negative lines of code. :)