@@ -436,6 +436,14 @@ class SplicingTableScreen(
436
436
437
437
private fun isEdgeSelected (index : Int ) = selection?.let { it.start == index && it.end == null } ? : false
438
438
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
+
439
447
private fun onSelectIota (index : Int ) {
440
448
if (! data.isInRange(index)) return
441
449
@@ -454,7 +462,7 @@ class SplicingTableScreen(
454
462
}
455
463
456
464
private fun onSelectEdge (index : Int ) {
457
- if (! (data.isInRange( index) || data.isInRange(index - 1 ) )) return
465
+ if (! isEdgeInRange( index)) return
458
466
459
467
val selection = selection
460
468
this .selection = if (isEdgeSelected(index)) {
@@ -762,7 +770,7 @@ class SplicingTableScreen(
762
770
763
771
private val index get() = viewStartIndex + offset
764
772
765
- override fun testVisible () = data.isInRange (index) || data.isInRange(index - 1 )
773
+ override fun testVisible () = isEdgeInRange (index)
766
774
767
775
override fun renderWidget (guiGraphics : GuiGraphics , mouseX : Int , mouseY : Int , partialTick : Float ) {
768
776
if (isHovered || index == (selection as ? Selection .Edge )?.index) {
0 commit comments