From a104de3509bbf55ae066efbf0cc08877236bb6b9 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 22 Aug 2014 08:51:37 -0400 Subject: [PATCH] fix(dom) selectByPattern: last selected file --- lib/client/dom.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/client/dom.js b/lib/client/dom.js index cfc4347e..895516ef 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -943,7 +943,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; }; function selectByPattern(msg, files) { - var n, + var n, regExp, allMsg = 'Specify file type for ' + msg + ' selection', i = 0, type, @@ -958,7 +958,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; if (type !== null) { SelectType = type; - type = Util.getRegExp(type); + regExp = Util.getRegExp(type); n = files && files.length; for (i = 0; i < n; i++) { @@ -966,7 +966,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; name = DOM.getCurrentName(current); if (name !== '..') { - isMatch = name.match(new RegExp(type)); + isMatch = regExp.test(name); if (isMatch) { ++matches; @@ -978,8 +978,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; if (isSelected) DOM.toggleSelectedFile(current); - } else if (!shouldSel) - ++i; + } } }