From d1cf4609268fb7fbae0716b6e699a130eea02647 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Thu, 27 Oct 2022 13:23:16 +0100 Subject: [PATCH] JAL-4083 only set globalUseScriptWait if needed --- src/jalview/ext/jmol/JalviewJmolBinding.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index a40da35..a529fae 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -269,11 +269,15 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel { if (atoms != null) { + // we set the globalUseScriptWait (and reset to previous value) only if + // we're going to use it here boolean useScriptWait = atoms.size() > 1; - boolean prevUseScriptWait = setGlobalUseScriptWait(useScriptWait); + boolean prevUseScriptWait = false; + if (useScriptWait) + prevUseScriptWait = setGlobalUseScriptWait(useScriptWait); if (resetLastRes.length() > 0) { - jmolScript(resetLastRes.toString()); + jmolScript(resetLastRes.toString(), useScriptWait); resetLastRes.setLength(0); } for (AtomSpec atom : atoms) @@ -281,7 +285,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel highlightAtom(atom.getAtomIndex(), atom.getPdbResNum(), atom.getChain(), atom.getPdbFile(), useScriptWait); } - setGlobalUseScriptWait(prevUseScriptWait); + if (useScriptWait) + setGlobalUseScriptWait(prevUseScriptWait); } } -- 1.7.10.2