Move SSD selection matching mode to typed Kotlin

ober

a42f31d39267d2ab7b443151fd9027fb690a264f

diff --git a/templates/ssd-review.ss b/templates/ssd-review.ss
index 2fb5cc5..e85c7d3 100644
--- a/templates/ssd-review.ss
+++ b/templates/ssd-review.ss
@@ -1237,7 +1237,8 @@
       (kotlin-imports (android graphics Bitmap))
       (typed-library (com sfb ssdreview)
         (export hitGroupId hitGroupIdForSession
-                selectionMatchingCells cellIdsForSelection
+                selectionMatchingCells selectionMatchingCellsForMode
+                cellIdsForSelection
                 clampInitialScale clampScale clampGroupFitScale
                 clampViewportOffset clampImageCoordinate
                 focusGroupScale groupCenterPoint fitImageViewportState
@@ -1290,6 +1291,12 @@
                     (mutable-list-add! out cell)
                     out)
                   out))))
+        (def (selectionMatchingCellsForMode (snapSelectionToCells : Bool)
+                                            (cells : (MutableList SsdCell))
+                                            (rect : FloatArray)) : (MutableList SsdCell)
+          (if (shouldCollectSelectionMatches snapSelectionToCells)
+            (selectionMatchingCells cells rect)
+            (mutable-list-empty SsdCell)))
         (def (cellIdsForSelection (cells : (MutableList SsdCell))) : (MutableList String)
           (for/fold ((ids (mutable-list-empty String)))
                     ((i (in-range (int32 0) (list-size cells))))
@@ -8603,7 +8610,7 @@
 	       "            onStatus(\"Selection ignored: drag a larger area\")"
 	       "            return"
 	       "        }"
-	       "        val matching = if (shouldCollectSelectionMatches(snapSelectionToCells)) selectionMatchingCells(activeSession.cells, rect) else mutableListOf()"
+	       "        val matching = selectionMatchingCellsForMode(snapSelectionToCells, activeSession.cells, rect)"
 	       "        val snapped = if (selectionUsesRawRect(snapSelectionToCells)) {"
 	       "            rect"
 	       "        } else if (selectionHasMatches(matching.size)) {"