Make SearchModel keep an accurate count of results without recounting every time

Also fixes a long-standing bug in updating line numbers for existing result matches.