sed: fix a case when one-line range matches past lines. Closes bug 1867.