From 1e09ccbc0cbfd3e14678c12ae925223a848f192b Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Thu, 14 Mar 2013 17:21:02 +0000 Subject: [PATCH] Extra code to find target tag Without this extra code, we would just be finding the previous tag with the matching name and not consider the depth. This code sets the cursor inside the potentially correct tag, gets the nest location without updating the display and if it's not at the correct depth, do i++ so we end up with another for loop to find the tag previous to that one and so on. The only way to escape out of this is to find a tag at the right depth. Set ch before line in the object, so it's similar to the order of the endPos object. --- lib/ice-coder.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/ice-coder.js b/lib/ice-coder.js index 2fa7d2f..3ac264b 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -309,13 +309,25 @@ var ICEcoder = { cursor.findPrevious(); searchPos.ch = cursor.from().ch; searchPos.line = cursor.from().line; + if (i==nestPos && 1==2) { + cursorX = cM.getSearchCursor(">",searchPos); + cursorX.findNext(); + searchPosX = new Object(); + searchPosX.ch = cursorX.from().ch+1; + searchPosX.line = cursorX.from().line; + cM.setCursor(searchPosX); + top.ICEcoder.getNestLocation(); + if (ICEcoder.htmlTagArray.length-1 != nestPos) { + i++; + } + } } // Once we've found our tag if (cursor.from()) { // Set our vars to match the start position startPos = new Object(); - top.ICEcoder.startPosCh = startPos.ch = cursor.from().ch; top.ICEcoder.startPosLine = startPos.line = cursor.from().line; + top.ICEcoder.startPosCh = startPos.ch = cursor.from().ch; // Now set an end position object that matches this start tag endPos = new Object(); endPos.line = top.ICEcoder.content.contentWindow.CodeMirror.tagRangeFinder(cM,startPos) || startPos.line;