fix some problems in the case pretty-printer

1. It needs to not collapse rows that depend on their pattern variables.
2. Only collapse when there are >2 rows to begin with.
3. Use tryfind instead of first twice.