Skip to content

Commit

Permalink
fix: frames whose constrains are bond to the content frame now syncho…
Browse files Browse the repository at this point in the history
…nize its right edge to the last column created by makecolumns method
  • Loading branch information
jodros committed Oct 22, 2023
1 parent 7bd675e commit b657742
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/frametricks/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,18 @@ function package:registerCommands ()
end, "Breaks the current frame in two vertically at the current location or at a point <offset> below the current location")

self:registerCommand("makecolumns", function (options, _)
local aligned = {}
options.columns = options.columns or 2
for key in pairs(SILE.frames) do
-- this must be checked before makecolumns() call, since the function changes the right() value of content
if SILE.getFrame(key):right() == SILE.getFrame("content"):right() and key ~= "content" then
table.insert(aligned, key)
end
end
makecolumns(options)
for _, frame in ipairs(aligned) do
SILE.getFrame(frame):constrain("right", SILE.getFrame("content_col"..options.columns-1):right())
end
end, "Split the current frame into multiple columns")

self:registerCommand("breakframehorizontal", function (options, _)
Expand Down
8 changes: 8 additions & 0 deletions tests/makecolumns.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Set paper size 419.5275636 595.275597
Begin page
Mx 207.4176
My 553.7327
Set font Gentium Plus;10;400;;normal;;;LTR
T 20 w=4.6924 (1)
End page
Finish
5 changes: 5 additions & 0 deletions tests/makecolumns.sil
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
\begin[papersize=a5]{document}
\script[src=packages/frametricks]
\makecolumns[columns=4]
\showframe[id=all]
\end{document}

0 comments on commit b657742

Please sign in to comment.