chiark / gitweb /
script: bind 't' to new explicit raise feature
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 6 Jul 2021 00:42:37 +0000 (01:42 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 6 Jul 2021 00:57:37 +0000 (01:57 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/script.ts

index dc4d012ef364507a0e5964ff61f2ed0a5dd2ec26..d6a7acfb0cc672c4fa4559ffe5ec2b6cdf9d3eb5 100644 (file)
@@ -337,6 +337,13 @@ function recompute_keybindings() {
       opname: "lower",
       desc: "send to bottom (below other pieces)",
     });
+    add_uo(all_targets, {
+      def_key: 't',
+      kind: 'Client',
+      wrc: 'Predictable',
+      opname: "raise",
+      desc: "raise to top",
+    });
   }
   if (all_targets.length) {
     let got = 0;
@@ -803,6 +810,16 @@ function pin_unpin(uo: UoRecord, newpin: boolean) {
 
 // ----- raising -----
 
+keyops_local['raise'] = function (uo: UoRecord) { raise_targets(uo); }
+
+function raise_targets(uo: UoRecord) {
+  for (let piece of uo.targets!) {
+    let p = pieces[piece]!;
+    if (p.pinned || !piece_moveable(p)) continue;
+    piece_raise(piece, p, "NotYet");
+  }
+}
+
 function piece_raise(piece: PieceId, p: PieceInfo,
                     new_held_us_raising: HeldUsRaising) {
   p.held_us_raising = new_held_us_raising;