If you have this layout of chests:
c
c
c
cccccccccccc
And you select them all at once.
The top group will never get merged if you don't select it individually.
This is because of architecture flaw of mod:
SortIntoGroups(player, entities, mergeHorizontaly)
function takes 'mergeHorizontaly' parameter, which is calculated like this
local width, height = MergingChests.FindBoundingBoxSize(entities)
...
local mergeHorizontaly = width > height
So it's up to bounding box to decide if vertical chests or horizontal will get merged.
Which isn't seems to be correct.
Im my opinion the correct would be if SortIntoGroups will not have this param and will return all the groups: vertical and horizontal ones, as it's expected by functions name.
However i'm not fixing this by myself because fixing it will affect three core functions of this mod.
And if I change them i don't think that would be easier for you to check and merge them into your code than to fix them by yourself after this explanation of the problem.