* commit 'eb4bd19ef09b2c277347b08c4a050f01f686c9c2': Terminate loop properly when cursor window is full. DO NOT MERGE