a better version of deac3fa2b30a45d0945f895f4181d916df922b58

This time with test cases, and also without changing the
semantics of unhighlight-range

related to PR 13488