@@ -436,6 +436,14 @@ class SplicingTableScreen(
436436
437437 private fun isEdgeSelected (index : Int ) = selection?.let { it.start == index && it.end == null } ? : false
438438
439+ private fun isEdgeInRange (index : Int ) =
440+ // cell to the right is in range
441+ data.isInRange(index)
442+ // cell to the left is in range
443+ || data.isInRange(index - 1 )
444+ // allow selecting leftmost edge of empty list
445+ || (index == 0 && data.list?.size == 0 )
446+
439447 private fun onSelectIota (index : Int ) {
440448 if (! data.isInRange(index)) return
441449
@@ -454,7 +462,7 @@ class SplicingTableScreen(
454462 }
455463
456464 private fun onSelectEdge (index : Int ) {
457- if (! (data.isInRange( index) || data.isInRange(index - 1 ) )) return
465+ if (! isEdgeInRange( index)) return
458466
459467 val selection = selection
460468 this .selection = if (isEdgeSelected(index)) {
@@ -762,7 +770,7 @@ class SplicingTableScreen(
762770
763771 private val index get() = viewStartIndex + offset
764772
765- override fun testVisible () = data.isInRange (index) || data.isInRange(index - 1 )
773+ override fun testVisible () = isEdgeInRange (index)
766774
767775 override fun renderWidget (guiGraphics : GuiGraphics , mouseX : Int , mouseY : Int , partialTick : Float ) {
768776 if (isHovered || index == (selection as ? Selection .Edge )?.index) {
0 commit comments