The border range test introduced by d09d9ceae79 breaks Trim / Extend for lines that do not overlap in X or Y. Recreate by trying to trim one line against another that is, for example, completely above it.
I think the fix is to do the bounds test only after checking that one of entities isn't a line. In any event, reverting that commit fixes Trim / Extend.
Do you want an entry in the bug tracker for bugs that are only in the master branch and for which the problem is identified?