From 76adcc51a0db435d03bd16c013e4a201d52925d2 Mon Sep 17 00:00:00 2001 From: Adam Jimenez Date: Mon, 9 Jun 2014 14:12:10 +0100 Subject: [PATCH] Revert "Jump To Matching Tag" This reverts commit 9a4a387de65d035a49f1398befc3c8541d1c02c3. --- lib/ace/commands/default_commands.js | 12 ---- lib/ace/editor.js | 95 ---------------------------- 2 files changed, 107 deletions(-) diff --git a/lib/ace/commands/default_commands.js b/lib/ace/commands/default_commands.js index e7cb56ad..77cdfc61 100644 --- a/lib/ace/commands/default_commands.js +++ b/lib/ace/commands/default_commands.js @@ -402,18 +402,6 @@ exports.commands = [{ exec: function(editor) { editor.jumpToMatching(true); }, multiSelectAction: "forEach", readOnly: true -}, { - name: "jumptomatchingtag", - bindKey: bindKey("Alt-P", "Alt-Shift-P"), - exec: function(editor) { editor.jumpToMatchingTag(); }, - multiSelectAction: "forEach", - readOnly: true -}, { - name: "selecttomatchingtag", - bindKey: bindKey("Alt-Shift-P", null), - exec: function(editor) { editor.jumpToMatchingTag(true); }, - multiSelectAction: "forEach", - readOnly: true }, // commands disabled in readOnly mode diff --git a/lib/ace/editor.js b/lib/ace/editor.js index da77e185..ef2d9f1a 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -48,7 +48,6 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter; var CommandManager = require("./commands/command_manager").CommandManager; var defaultCommands = require("./commands/default_commands").commands; var config = require("./config"); -var TokenIterator = require("./token_iterator").TokenIterator; /** * The main entry point into the Ace functionality. @@ -1949,100 +1948,6 @@ var Editor = function(renderer, session) { } }; - /** - * Moves the cursor's row and column to the next matching tag. - * - **/ - this.jumpToMatchingTag = function(select) { - var tag; - var depth = {}; - var sel = {}; - var cursor = this.getCursorPosition(); - var iterator = new TokenIterator(this.session, cursor.row, cursor.column); - var prevToken = iterator.getCurrentToken(); - var token = iterator.stepForward(); - - //get next closing tag - if (!token || token.type.indexOf('tag-name') === -1) { - do { - prevToken = token; - token = iterator.stepForward(); - - if(token && token.type.indexOf('tag-name') !== -1) { - if (isNaN(depth[token.value])) { - depth[token.value] = 0; - } - - if (prevToken.value==='<' ){ - depth[token.value]++; - } else if ( prevToken.value==='=0)); - } - - if (token && token.type.indexOf('tag-name') !== -1) { - sel.end = { - column: iterator.getCurrentTokenColumn()-2, - row: iterator.getCurrentTokenRow() - }; - tag = token.value; - } - - //no tag found - if (!tag) { - return; - } - - //find matching tag - do { - token = prevToken; - prevToken = iterator.stepBackward(); - - if( prevToken ){ - if (prevToken.type.indexOf('tag-close') !== -1) { - sel.start = { - column: iterator.getCurrentTokenColumn()+1, - row: iterator.getCurrentTokenRow() - }; - } - - if (token.value===tag && token.type.indexOf('tag-name') !== -1 && prevToken.value==='<') { - depth[tag]++; - } else if ( token.value===tag && token.type.indexOf('tag-name') !== -1 && prevToken.value==='