From c861ac14b9e536fb15efa4c491e92f505cc914ac Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Fri, 8 Jan 2016 22:27:14 +0100 Subject: [PATCH] fix posFromString --- src/lib/plugins/commands.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/plugins/commands.js b/src/lib/plugins/commands.js index 8de032b..835807c 100644 --- a/src/lib/plugins/commands.js +++ b/src/lib/plugins/commands.js @@ -296,8 +296,8 @@ module.exports.server = function(serv) { }; serv.posFromString = (str, pos) => { - if (parseInt(str)) return parseInt(str); - if (str.match(/~-?\d+/)) return parseInt(str.slice(1)) + pos; + if (str.indexOf("~")==-1) return parseFloat(str); + if (str.match(/~-?\d+/)) return parseFloat(str.slice(1)) + pos; else if (str == '~') return pos; else throw new UserError('Invalid position'); };