chiark / gitweb /
Introduce non-Quiet PUO::Insert
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 28 Apr 2022 22:55:48 +0000 (23:55 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 28 Apr 2022 22:56:15 +0000 (23:56 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
daemon/cmdlistener.rs
src/pcrender.rs
src/updates.rs
templates/script.ts

index 2410e1d24bfb50229ea498f4ca1f6c31c339494e..3d49123dc1c064986921d76f90d265ed4d2ed417 100644 (file)
@@ -1408,8 +1408,13 @@ impl UpdateHandler {
           use PieceUpdateOp::*;
           let oe = bulk.pieces.get(&upiece);
           let ne = match (oe, uuop) {
+            // We preserve Quietness rather than coalescing.  This avoids
+            // many more cases here, and this code is used for mgmt
+            // updates, which are generally Quiet anyway.
             ( None                    , e        ) => Some( e               ),
+            ( Some( Insert     (()) ) , Delete() ) => None,
             ( Some( InsertQuiet(()) ) , Delete() ) => None,
+            ( Some( Insert     (()) ) , _        ) => Some( Insert     (()) ),
             ( Some( InsertQuiet(()) ) , _        ) => Some( InsertQuiet(()) ),
             ( Some( Delete     (  ) ) , _        ) => Some( Modify     (()) ),
             ( _                       , _        ) => Some( Modify     (()) ),
index 38350e80dbcfcbdf9571d350a1741f3537399ff9..02719dcd1749addaf64edb07c07c3c31085afcbb 100644 (file)
@@ -99,7 +99,7 @@ impl PieceRenderInstructions {
     if matches_doesnot!(
       op,
       = Move(_) | MoveQuiet(_) | SetZLevel(_) | SetZLevelQuiet(_),
-      ! Delete() | InsertQuiet(_) | Modify(_) | ModifyQuiet(_),
+      ! Delete() | Insert(_) | InsertQuiet(_) | Modify(_) | ModifyQuiet(_),
     ) {
       match self.occulted {
         Visible(_) | Occulted => (),
index e9967c0721061c74c9a084422d0a3573c5e44220..2215cfb2c1c2fe92bc0c91e694a437c11121386c 100644 (file)
@@ -155,6 +155,7 @@ pub struct DataLoadPlayer {
 // Quiet means not to produce the yellow halo (see `movements` in script.ts)
 pub enum PieceUpdateOp<NS,ZL> {
   Delete(),
+  Insert(NS),
   InsertQuiet(NS),
   Modify(NS),
   ModifyQuiet(NS),
@@ -428,6 +429,7 @@ impl<NS,ZC> PieceUpdateOp<NS,ZC> {
     use PieceUpdateOp::*;
     match self {
       Delete() => None,
+      Insert(ns) => Some(ns),
       InsertQuiet(ns) => Some(ns),
       Modify(ns) => Some(ns),
       ModifyQuiet(ns) => Some(ns),
@@ -445,6 +447,7 @@ impl<NS,ZC> PieceUpdateOp<NS,ZC> {
     use PieceUpdateOp::*;
     Ok(match self {
       Delete() => Delete(),
+      Insert(ns) => Insert(f(ns)?),
       InsertQuiet(ns) => InsertQuiet(f(ns)?),
       Modify(ns) => Modify(f(ns)?),
       ModifyQuiet(ns) => ModifyQuiet(f(ns)?),
@@ -458,6 +461,7 @@ impl<NS,ZC> PieceUpdateOp<NS,ZC> {
     use PieceUpdateOp::*;
     match self {
       Delete() => Delete(),
+      Insert(ns) => Insert(ns),
       InsertQuiet(ns) => InsertQuiet(ns),
       Modify(ns) => Modify(ns),
       ModifyQuiet(ns) => ModifyQuiet(ns),
@@ -483,6 +487,7 @@ impl<NS,ZC> PieceUpdateOp<NS,ZC> {
     use PieceUpdateOp::*;
     match self {
       Delete() => None,
+      Insert(_) => None,
       InsertQuiet(_) => None,
       Modify(_) => None,
       ModifyQuiet(_) => None,
index 6a3b7bba7993dca064aacabdbc74bb677ea059e6..e55185a2f9f170b0aff6aad17613781e063abfbd 100644 (file)
@@ -1790,6 +1790,11 @@ pieceops.Modify = <PieceHandler>function
 }
 
 pieceops.InsertQuiet = <PieceHandler>(insert_piece as any);
+pieceops.Insert = <PieceHandler>function
+(piece: PieceId, xp: any, info: PreparedPieceState) {
+  let p = insert_piece(piece,xp,info);
+  piece_note_moved(piece,p);
+}
 
 function insert_piece(piece: PieceId, xp: any,
                      info: PreparedPieceState): PieceInfo