[Solved] Problem to create a function for close empty note_columns

The routine I used in that revision for ledgers tool should indeed be among the fastest for exactly this task (scanning which note column is the most “far right” in use, or for accessing multiple note columns per line in general). This is because it only accesses the renoise.song() object once for every patternline, instead of 12 times.

The pattern matching used in the code should show the principle, I hope (line 79-81 in main.lua are most interesting).

https://forum.renoise.com/t/new-tool-2-7-3-1-set-track-width-to-active-columns/31078

PS. I cannot help you with the specific implementation for your tool, though.