This *has* to be a bug.
Enemy is in darkness a couple squares away. Rogue readies a ranged attack. Enemy steps out of darkness into light spell to poke at the fighter, takes a swipe, then disengages and runs back into the darkness. THEN the rogue takes the ranged attack when the enemy is in darkness and no longer near a companion.