I've noticed that when adding regions to adjacent sections they often act as if they are overlapping, and you get one on a lower row to the adjacent one in the ruler. This will often be corrected if you shift the edge of the region back and forth manually.
This became an issue in a script I wrote which was for flagging region overlaps, but not adjacent regions.
I had to put this subtraction in to correct it:
if pos < prevend-0.0000000001 then
Code:
function CheckRegionOverlapsWithinTime(startpos,endpos)
local prevend=-1
local regionsdetected = false
for i=0, reaper.CountProjectMarkers(0) -1 do
local retval, isrgn, pos, rgnend, name, markrgnindexnumber = reaper.EnumProjectMarkers(i)
if pos >= startpos and pos <= endpos then
regionsdetected = true
if pos < prevend-0.0000000001 then
error("Overlapping regions detected. Regions must have gaps between them.")
return false
else
prevend = rgnend
end
end
end
if not regionsdetected then
error( "No regions detected around items.")
end
return regionsdetected
end