From f7077f992dd8538eed50659ac3c633cc213137d2 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Thu, 15 Feb 2024 19:44:25 -0700 Subject: [PATCH] allow aborting defineLastDelay --- src/hollywoo/Movie.kiss | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/hollywoo/Movie.kiss b/src/hollywoo/Movie.kiss index df2932e..0688cf5 100644 --- a/src/hollywoo/Movie.kiss +++ b/src/hollywoo/Movie.kiss @@ -621,11 +621,18 @@ (localFunction redefineLastDelay [cc] (set lastCommand redefineLastDelay) - (director.enterString "Redefine $lastDelay from $lastDelayLength sec?" - ->lengthStr - (let [length (Std.parseFloat lengthStr)] - (delayLengths.put lastDelay (new HFloat length)) - (cc)))) + (if lastDelay + (director.enterString "Redefine $lastDelay from $lastDelayLength sec?" + ->lengthStr + (let [length (Std.parseFloat lengthStr)] + (if (Math.isNaN length) + (print "Failed to parse ${lengthStr}. leaving value the same") + (delayLengths.put lastDelay (new HFloat length))) + (cc))) + { + (print "no delay to redefine") + (cc) + })) (shortcutHandler.registerItem "[d]efine [d]elay" redefineLastDelay) (shortcutHandler.registerItem "[d]efine [m]isc [i]nt"