added wrap mode detect via line sampling; now ignores wm