(2022-04-02, 3:42)N. W. Perry Wrote: Hmm, so the logic of buffer exchange is a little trickier than I thought. It's easy enough when there's just one block of store/retrieve statements—just hide everything between the first store and the last retrieve. But when there are multiple hidden blocks with some visible lines in between them, it's harder.
I'm not completely sure without testing myself (been awhile since I wrote the relevant code) but I think you can use ref:getVisible to test if the line is currently visible inside LDCad's editor.
Downside is this function is only available on reference lines, and as you are looping all lines you will probably be working with the generic srcLine object.
You can determine a line to be a reference line by using srcLine:isRef but this still doesn't give you access to a refLine object. (you just gave me the idea to add an 'asRefLine' function to srcLine )
A possible workaround for this could be to also load all references and setup a mapping table to find the reference with the same getLineIndex value the current srcLine has.
Alternative to all this would be to implement the buffer exchange rules while looping the lines.