I applied a similar fix like you proposed, just omit highlighting at all if I get a zero length match. Changes committed to CVS.