   pick length 1 - '[ , min ] bi@
   rot exchange ;
 
-: move-left ( tiling -- tiling )
+: move-prev ( tiling -- tiling )
   dup [ gadgets>> ] [ focused>> 1 - ] [ focused>> ] tri exchanged!
-  focus-left ;
+  focus-prev ;
 
-: move-right ( tiling -- tiling )
+: move-next ( tiling -- tiling )
   dup [ gadgets>> ] [ focused>> ] [ focused>> 1 + ] tri exchanged!
-  focus-right ;
+  focus-next ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-: add-column ( tiling -- tiling )
-  dup columns>> 1 + >>columns
+: add-tile ( tiling -- tiling )
+  dup tiles>> 1 + >>tiles
   tiling-map-gadgets ;
 
-: del-column ( tiling -- tiling )
-  dup columns>> 1 - 1 max >>columns
+: del-tile ( tiling -- tiling )
+  dup tiles>> 1 - 1 max >>tiles
   tiling-map-gadgets ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


: first-viewable ( tiling -- index ) first>> ;

: last-viewable ( tiling -- index ) [ first>> ] [ columns>> ] bi + 1 - ;

! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!



! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

TUPLE: tiling-shelf < tiling ;
TUPLE: tiling-pile  < tiling ;

: <tiling-shelf> ( -- gadget )
  tiling-shelf new init-tiling { 1 0 } >>orientation ;

: <tiling-pile> ( -- gadget )
  tiling-pile new init-tiling { 0 1 } >>orientation ;

tiling-shelf
 H{
    { T{ key-down f { A+    } "LEFT"  } [ focus-prev  drop ] }
    { T{ key-down f { A+    } "RIGHT" } [ focus-next drop ] }
    { T{ key-down f { S+ A+ } "LEFT"  } [ move-prev   drop ] }
    { T{ key-down f { S+ A+ } "RIGHT" } [ move-next  drop ] }
    { T{ key-down f { C+    } "["     } [ del-tile  drop ] }
    { T{ key-down f { C+    } "]"     } [ add-tile  drop ] }
  }
set-gestures

tiling-pile
 H{
    { T{ key-down f { A+    } "UP"  } [ focus-prev  drop ] }
    { T{ key-down f { A+    } "DOWN" } [ focus-next drop ] }
    { T{ key-down f { S+ A+ } "UP"  } [ move-prev   drop ] }
    { T{ key-down f { S+ A+ } "DOWN" } [ move-next  drop ] }
    { T{ key-down f { C+    } "["     } [ del-tile  drop ] }
    { T{ key-down f { C+    } "]"     } [ add-tile  drop ] }
  }
set-gestures
