From 7243a21c61af09ed329b243de383c879395f998d Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Sat, 21 Sep 2019 21:33:55 +0100 Subject: [PATCH] Can pass charNo (int) and noFocus (bool) --- lib/ice-coder.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/ice-coder.js b/lib/ice-coder.js index a4092f9..38f2c47 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -1102,10 +1102,11 @@ var ICEcoder = { }, // Go to a specific line number - goToLine: function(lineNo) { + goToLine: function(lineNo, charNo, noFocus) { var cM, cMdiff, thisCM; lineNo = lineNo ? lineNo-1 : top.get('goToLineNo').value-1; + charNo = charNo ? charNo : 0; cM = ICEcoder.getcMInstance(); cMdiff = ICEcoder.getcMdiffInstance(); @@ -1127,10 +1128,12 @@ var ICEcoder = { } },10); - thisCM.setCursor(lineNo); - top.ICEcoder.focus(); - // Also do this after a 0ms tickover incase DOM wasn't ready - setTimeout(function(){top.ICEcoder.focus();},0); + thisCM.setCursor(lineNo, charNo); + if (!noFocus) { + top.ICEcoder.focus(); + // Also do this after a 0ms tickover incase DOM wasn't ready + setTimeout(function(){top.ICEcoder.focus();},0); + } return false; },