add stupid semicolons;
This commit is contained in:
parent
a2a3043907
commit
ab50850be6
3 changed files with 112 additions and 121 deletions
|
|
@ -39,22 +39,15 @@ var repeat = function repeat(fn, count, args) {
|
||||||
fn.apply(this, args);
|
fn.apply(this, args);
|
||||||
};
|
};
|
||||||
|
|
||||||
var toggleCase = function toggleCase(ch) {
|
|
||||||
if (ch.toUpperCase() === ch)
|
|
||||||
return ch.toLowerCase();
|
|
||||||
else
|
|
||||||
return ch.toUpperCase();
|
|
||||||
};
|
|
||||||
|
|
||||||
var ensureScrollMargin = function(editor) {
|
var ensureScrollMargin = function(editor) {
|
||||||
var renderer = editor.renderer
|
var renderer = editor.renderer;
|
||||||
var pos = renderer.$cursorLayer.getPixelPosition();
|
var pos = renderer.$cursorLayer.getPixelPosition();
|
||||||
|
|
||||||
var top = pos.top;
|
var top = pos.top;
|
||||||
|
|
||||||
var margin = HMARGIN * renderer.layerConfig.lineHeight;
|
var margin = HMARGIN * renderer.layerConfig.lineHeight;
|
||||||
if (2 * margin > renderer.$size.scrollerHeight)
|
if (2 * margin > renderer.$size.scrollerHeight)
|
||||||
margin = renderer.$size.scrollerHeight / 2
|
margin = renderer.$size.scrollerHeight / 2;
|
||||||
|
|
||||||
if (renderer.scrollTop > top - margin) {
|
if (renderer.scrollTop > top - margin) {
|
||||||
renderer.session.setScrollTop(top - margin);
|
renderer.session.setScrollTop(top - margin);
|
||||||
|
|
@ -102,11 +95,11 @@ var actions = {
|
||||||
repeat(function() {
|
repeat(function() {
|
||||||
var range = editor.selection.getRange();
|
var range = editor.selection.getRange();
|
||||||
if (range.isEmpty())
|
if (range.isEmpty())
|
||||||
range.end.column++
|
range.end.column++;
|
||||||
var text = editor.session.getTextRange(range)
|
var text = editor.session.getTextRange(range);
|
||||||
var toggled = text.toUpperCase()
|
var toggled = text.toUpperCase();
|
||||||
if (toggled == text)
|
if (toggled == text)
|
||||||
editor.navigateRight()
|
editor.navigateRight();
|
||||||
else
|
else
|
||||||
editor.session.replace(range, toggled);
|
editor.session.replace(range, toggled);
|
||||||
}, count || 1);
|
}, count || 1);
|
||||||
|
|
@ -142,7 +135,7 @@ var actions = {
|
||||||
ensureScrollMargin(editor);
|
ensureScrollMargin(editor);
|
||||||
var r = editor.selection.getRange();
|
var r = editor.selection.getRange();
|
||||||
r.end.row = r.start.row;
|
r.end.row = r.start.row;
|
||||||
r.end.column = r.start.column
|
r.end.column = r.start.column;
|
||||||
editor.selection.setSelectionRange(r, true);
|
editor.selection.setSelectionRange(r, true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -155,7 +148,7 @@ var actions = {
|
||||||
ensureScrollMargin(editor);
|
ensureScrollMargin(editor);
|
||||||
var r = editor.selection.getRange();
|
var r = editor.selection.getRange();
|
||||||
r.end.row = r.start.row;
|
r.end.row = r.start.row;
|
||||||
r.end.column = r.start.column
|
r.end.column = r.start.column;
|
||||||
editor.selection.setSelectionRange(r, true);
|
editor.selection.setSelectionRange(r, true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -225,7 +218,7 @@ var actions = {
|
||||||
},
|
},
|
||||||
"J": {
|
"J": {
|
||||||
fn: function(editor, range, count, param) {
|
fn: function(editor, range, count, param) {
|
||||||
var session = editor.session
|
var session = editor.session;
|
||||||
range = editor.getSelectionRange();
|
range = editor.getSelectionRange();
|
||||||
var pos = {row: range.start.row, column: range.start.column};
|
var pos = {row: range.start.row, column: range.start.column};
|
||||||
count = count || range.end.row - range.start.row;
|
count = count || range.end.row - range.start.row;
|
||||||
|
|
@ -235,7 +228,7 @@ var actions = {
|
||||||
range.end.column = session.getLine(maxRow).length;
|
range.end.column = session.getLine(maxRow).length;
|
||||||
range.end.row = maxRow;
|
range.end.row = maxRow;
|
||||||
|
|
||||||
var text = ""
|
var text = "";
|
||||||
for (var i = pos.row; i < maxRow; i++) {
|
for (var i = pos.row; i < maxRow; i++) {
|
||||||
var nextLine = session.getLine(i + 1);
|
var nextLine = session.getLine(i + 1);
|
||||||
text += " " + /^\s*(.*)$/.exec(nextLine)[1] || "";
|
text += " " + /^\s*(.*)$/.exec(nextLine)[1] || "";
|
||||||
|
|
@ -529,7 +522,7 @@ var handleCursorMove = exports.onCursorMove = function(editor, e) {
|
||||||
else {
|
else {
|
||||||
if (e && (util.onVisualLineMode || util.onVisualMode)) {
|
if (e && (util.onVisualLineMode || util.onVisualMode)) {
|
||||||
editor.selection.clearSelection();
|
editor.selection.clearSelection();
|
||||||
util.normalMode(editor)
|
util.normalMode(editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCursorMove.running = true;
|
handleCursorMove.running = true;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ var startCommands = {
|
||||||
command: coreCommands.start
|
command: coreCommands.start
|
||||||
},
|
},
|
||||||
'I': {
|
'I': {
|
||||||
command: coreCommands.startBeginning,
|
command: coreCommands.startBeginning
|
||||||
},
|
},
|
||||||
'a': {
|
'a': {
|
||||||
command: coreCommands.append
|
command: coreCommands.append
|
||||||
|
|
@ -42,20 +42,18 @@ exports.handler = {
|
||||||
exec: function(editor) {cmds.inputBuffer.push(editor, key);}
|
exec: function(editor) {cmds.inputBuffer.push(editor, key);}
|
||||||
} };
|
} };
|
||||||
} // wait for input
|
} // wait for input
|
||||||
else if (key.length === 1 && (hashId == 0 || hashId === 4)) { //no modifier || shift
|
else if (key.length == 1 && (hashId == 0 || hashId == 4)) { //no modifier || shift
|
||||||
return {command: "null", stopEvent: false}
|
return {command: "null", stopEvent: false};
|
||||||
} else if (key == 'esc') {
|
} else if (key == 'esc') {
|
||||||
return {command: coreCommands.stop};
|
return {command: coreCommands.stop};
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (key == 'esc' || key == 'ctrl-[') {
|
if (key == 'esc' || key == 'ctrl-[') {
|
||||||
data.state = 'start'
|
data.state = 'start';
|
||||||
return {command: coreCommands.stop}
|
return {command: coreCommands.stop};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -14,37 +14,37 @@ var keepScrollPosition = function(editor, fn) {
|
||||||
|
|
||||||
function Motion(getRange, type){
|
function Motion(getRange, type){
|
||||||
if (type == 'extend')
|
if (type == 'extend')
|
||||||
var extend = true
|
var extend = true;
|
||||||
else
|
else
|
||||||
var reverse = type
|
var reverse = type;
|
||||||
|
|
||||||
this.nav = function(editor) {
|
this.nav = function(editor) {
|
||||||
var r = getRange(editor);
|
var r = getRange(editor);
|
||||||
if (!r)
|
if (!r)
|
||||||
return
|
return;
|
||||||
if (!r.end)
|
if (!r.end)
|
||||||
var a = r
|
var a = r;
|
||||||
else if (reverse)
|
else if (reverse)
|
||||||
var a = r.start
|
var a = r.start;
|
||||||
else
|
else
|
||||||
var a = r.end
|
var a = r.end;
|
||||||
|
|
||||||
editor.clearSelection()
|
editor.clearSelection();
|
||||||
editor.moveCursorTo(a.row, a.column);
|
editor.moveCursorTo(a.row, a.column);
|
||||||
}
|
}
|
||||||
this.sel = function(editor){
|
this.sel = function(editor){
|
||||||
var r = getRange(editor);
|
var r = getRange(editor);
|
||||||
if (!r)
|
if (!r)
|
||||||
return
|
return;
|
||||||
if (extend)
|
if (extend)
|
||||||
return editor.selection.setSelectionRange(r);
|
return editor.selection.setSelectionRange(r);
|
||||||
|
|
||||||
if (!r.end)
|
if (!r.end)
|
||||||
var a = r
|
var a = r;
|
||||||
else if (reverse)
|
else if (reverse)
|
||||||
var a = r.start
|
var a = r.start;
|
||||||
else
|
else
|
||||||
var a = r.end
|
var a = r.end;
|
||||||
|
|
||||||
editor.selection.selectTo(a.row, a.column);
|
editor.selection.selectTo(a.row, a.column);
|
||||||
}
|
}
|
||||||
|
|
@ -54,61 +54,61 @@ var nonWordRe = /[\s.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/;
|
||||||
var wordSeparatorRe = /[.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/;
|
var wordSeparatorRe = /[.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/;
|
||||||
var whiteRe = /\s/;
|
var whiteRe = /\s/;
|
||||||
var StringStream = function(editor, cursor) {
|
var StringStream = function(editor, cursor) {
|
||||||
var sel = editor.selection
|
var sel = editor.selection;
|
||||||
this.range = sel.getRange()
|
this.range = sel.getRange();
|
||||||
cursor = cursor || sel.selectionLead
|
cursor = cursor || sel.selectionLead;
|
||||||
this.row = cursor.row;
|
this.row = cursor.row;
|
||||||
this.col = cursor.column;
|
this.col = cursor.column;
|
||||||
var line = editor.session.getLine(this.row);
|
var line = editor.session.getLine(this.row);
|
||||||
var maxRow = editor.session.getLength()
|
var maxRow = editor.session.getLength()
|
||||||
this.ch = line[this.col] || '\n'
|
this.ch = line[this.col] || '\n'
|
||||||
this.skippedLines = 0
|
this.skippedLines = 0;
|
||||||
|
|
||||||
this.next = function() {
|
this.next = function() {
|
||||||
this.ch = line[++this.col] || this.handleNewLine(1)
|
this.ch = line[++this.col] || this.handleNewLine(1);
|
||||||
//this.debug()
|
//this.debug()
|
||||||
return this.ch
|
return this.ch;
|
||||||
}
|
}
|
||||||
this.prev = function() {
|
this.prev = function() {
|
||||||
this.ch = line[--this.col] || this.handleNewLine(-1)
|
this.ch = line[--this.col] || this.handleNewLine(-1);
|
||||||
//this.debug()
|
//this.debug()
|
||||||
return this.ch
|
return this.ch;
|
||||||
}
|
}
|
||||||
this.peek = function(dir) {
|
this.peek = function(dir) {
|
||||||
var ch = line[this.col + dir]
|
var ch = line[this.col + dir];
|
||||||
if (ch)
|
if (ch)
|
||||||
return ch
|
return ch;
|
||||||
if (dir == -1)
|
if (dir == -1)
|
||||||
return '\n'
|
return '\n';
|
||||||
if (this.col == line.length - 1)
|
if (this.col == line.length - 1)
|
||||||
return '\n'
|
return '\n';
|
||||||
return editor.session.getLine(this.row + 1)[0] || '\n'
|
return editor.session.getLine(this.row + 1)[0] || '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
this.handleNewLine = function(dir) {
|
this.handleNewLine = function(dir) {
|
||||||
if (dir == 1){
|
if (dir == 1){
|
||||||
if (this.col == line.length)
|
if (this.col == line.length)
|
||||||
return '\n'
|
return '\n';
|
||||||
if (this.row == maxRow - 1)
|
if (this.row == maxRow - 1)
|
||||||
return ''
|
return '';
|
||||||
this.col = 0
|
this.col = 0;
|
||||||
this.row ++
|
this.row ++;
|
||||||
line = editor.session.getLine(this.row)
|
line = editor.session.getLine(this.row);
|
||||||
this.skippedLines++
|
this.skippedLines++;
|
||||||
return line[0] || '\n'
|
return line[0] || '\n';
|
||||||
}
|
}
|
||||||
if (dir == -1) {
|
if (dir == -1) {
|
||||||
if (this.row == 0)
|
if (this.row == 0)
|
||||||
return ''
|
return '';
|
||||||
this.row --
|
this.row --;
|
||||||
line = editor.session.getLine(this.row)
|
line = editor.session.getLine(this.row);
|
||||||
this.col = line.length;
|
this.col = line.length;
|
||||||
this.skippedLines--
|
this.skippedLines--;
|
||||||
return '\n'
|
return '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.debug = function() {
|
this.debug = function() {
|
||||||
console.log(line.substring(0, this.col)+'|'+this.ch+'\''+this.col+'\''+line.substr(this.col+1))
|
console.log(line.substring(0, this.col)+'|'+this.ch+'\''+this.col+'\''+line.substr(this.col+1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -116,93 +116,93 @@ var Search = require("ace/search").Search;
|
||||||
var search = new Search();
|
var search = new Search();
|
||||||
|
|
||||||
function find(editor, needle, dir) {
|
function find(editor, needle, dir) {
|
||||||
search.$options.needle = needle
|
search.$options.needle = needle;
|
||||||
search.$options.backwards = dir == -1
|
search.$options.backwards = dir == -1;
|
||||||
return search.find(editor.session)
|
return search.find(editor.session);
|
||||||
}
|
}
|
||||||
var lang = require("ace/lib/lang");
|
|
||||||
var Range = require("ace/range").Range;
|
var Range = require("ace/range").Range;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"w": new Motion(function(editor) {
|
"w": new Motion(function(editor) {
|
||||||
var str = new StringStream(editor)
|
var str = new StringStream(editor);
|
||||||
|
|
||||||
if (str.ch && wordSeparatorRe.test(str.ch)) {
|
if (str.ch && wordSeparatorRe.test(str.ch)) {
|
||||||
while (str.ch && wordSeparatorRe.test(str.ch))
|
while (str.ch && wordSeparatorRe.test(str.ch))
|
||||||
str.next()
|
str.next();
|
||||||
} else {
|
} else {
|
||||||
while (str.ch && !nonWordRe.test(str.ch))
|
while (str.ch && !nonWordRe.test(str.ch))
|
||||||
str.next()
|
str.next();
|
||||||
}
|
}
|
||||||
while (str.ch && whiteRe.test(str.ch) && str.skippedLines < 2)
|
while (str.ch && whiteRe.test(str.ch) && str.skippedLines < 2)
|
||||||
str.next()
|
str.next();
|
||||||
|
|
||||||
str.skippedLines == 2 && str.prev()
|
str.skippedLines == 2 && str.prev();
|
||||||
return {column: str.col, row: str.row}
|
return {column: str.col, row: str.row};
|
||||||
}),
|
}),
|
||||||
"W": new Motion(function(editor) {
|
"W": new Motion(function(editor) {
|
||||||
var str = new StringStream(editor)
|
var str = new StringStream(editor);
|
||||||
while(str.ch && !(whiteRe.test(str.ch) && !whiteRe.test(str.peek(1))) && str.skippedLines < 2)
|
while(str.ch && !(whiteRe.test(str.ch) && !whiteRe.test(str.peek(1))) && str.skippedLines < 2)
|
||||||
str.next()
|
str.next();
|
||||||
if (str.skippedLines == 2)
|
if (str.skippedLines == 2)
|
||||||
str.prev()
|
str.prev();
|
||||||
else
|
else
|
||||||
str.next()
|
str.next();
|
||||||
|
|
||||||
return {column: str.col, row: str.row}
|
return {column: str.col, row: str.row}
|
||||||
}),
|
}),
|
||||||
"b": new Motion(function(editor) {
|
"b": new Motion(function(editor) {
|
||||||
var str = new StringStream(editor)
|
var str = new StringStream(editor);
|
||||||
|
|
||||||
str.prev()
|
str.prev();
|
||||||
while (str.ch && whiteRe.test(str.ch) && str.skippedLines > -2)
|
while (str.ch && whiteRe.test(str.ch) && str.skippedLines > -2)
|
||||||
str.prev()
|
str.prev();
|
||||||
|
|
||||||
if (str.ch && wordSeparatorRe.test(str.ch)) {
|
if (str.ch && wordSeparatorRe.test(str.ch)) {
|
||||||
while (str.ch && wordSeparatorRe.test(str.ch))
|
while (str.ch && wordSeparatorRe.test(str.ch))
|
||||||
str.prev()
|
str.prev();
|
||||||
} else {
|
} else {
|
||||||
while (str.ch && !nonWordRe.test(str.ch))
|
while (str.ch && !nonWordRe.test(str.ch))
|
||||||
str.prev()
|
str.prev();
|
||||||
}
|
}
|
||||||
str.ch && str.next();
|
str.ch && str.next();
|
||||||
return {column: str.col, row: str.row}
|
return {column: str.col, row: str.row};
|
||||||
}),
|
}),
|
||||||
"B": new Motion(function(editor) {
|
"B": new Motion(function(editor) {
|
||||||
var str = new StringStream(editor)
|
var str = new StringStream(editor)
|
||||||
str.prev()
|
str.prev();
|
||||||
while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(-1))) && str.skippedLines > -2)
|
while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(-1))) && str.skippedLines > -2)
|
||||||
str.prev()
|
str.prev();
|
||||||
|
|
||||||
if (str.skippedLines == -2)
|
if (str.skippedLines == -2)
|
||||||
str.next()
|
str.next();
|
||||||
|
|
||||||
return {column: str.col, row: str.row}
|
return {column: str.col, row: str.row};
|
||||||
}, true),
|
}, true),
|
||||||
"e": new Motion(function(editor) {
|
"e": new Motion(function(editor) {
|
||||||
var str = new StringStream(editor)
|
var str = new StringStream(editor);
|
||||||
|
|
||||||
str.next()
|
str.next();
|
||||||
while (str.ch && whiteRe.test(str.ch))
|
while (str.ch && whiteRe.test(str.ch))
|
||||||
str.next()
|
str.next();
|
||||||
|
|
||||||
if (str.ch && wordSeparatorRe.test(str.ch)) {
|
if (str.ch && wordSeparatorRe.test(str.ch)) {
|
||||||
while (str.ch && wordSeparatorRe.test(str.ch))
|
while (str.ch && wordSeparatorRe.test(str.ch))
|
||||||
str.next()
|
str.next();
|
||||||
} else {
|
} else {
|
||||||
while (str.ch && !nonWordRe.test(str.ch))
|
while (str.ch && !nonWordRe.test(str.ch))
|
||||||
str.next()
|
str.next();
|
||||||
}
|
}
|
||||||
str.ch && str.prev()
|
str.ch && str.prev();
|
||||||
return {column: str.col, row: str.row}
|
return {column: str.col, row: str.row};
|
||||||
}),
|
}),
|
||||||
"E": new Motion(function(editor) {
|
"E": new Motion(function(editor) {
|
||||||
var str = new StringStream(editor)
|
var str = new StringStream(editor);
|
||||||
str.next()
|
str.next();
|
||||||
while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(1))))
|
while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(1))))
|
||||||
str.next()
|
str.next();
|
||||||
|
|
||||||
return {column: str.col, row: str.row}
|
return {column: str.col, row: str.row};
|
||||||
}),
|
}),
|
||||||
|
|
||||||
"l": {
|
"l": {
|
||||||
|
|
@ -265,10 +265,10 @@ module.exports = {
|
||||||
var cursor = editor.getCursorPosition()
|
var cursor = editor.getCursorPosition()
|
||||||
var end = editor.session.$findClosingBracket(param, cursor, /paren/)
|
var end = editor.session.$findClosingBracket(param, cursor, /paren/)
|
||||||
if (!end)
|
if (!end)
|
||||||
return
|
return;
|
||||||
var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/)
|
var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/)
|
||||||
if (!start)
|
if (!start)
|
||||||
return
|
return;
|
||||||
start.column ++;
|
start.column ++;
|
||||||
editor.selection.setSelectionRange(Range.fromPoints(start, end))
|
editor.selection.setSelectionRange(Range.fromPoints(start, end))
|
||||||
break
|
break
|
||||||
|
|
@ -277,10 +277,10 @@ module.exports = {
|
||||||
case "/":
|
case "/":
|
||||||
var end = find(editor, param, 1)
|
var end = find(editor, param, 1)
|
||||||
if (!end)
|
if (!end)
|
||||||
return
|
return;
|
||||||
var start = find(editor, param, -1)
|
var start = find(editor, param, -1)
|
||||||
if (!start)
|
if (!start)
|
||||||
return
|
return;
|
||||||
editor.selection.setSelectionRange(Range.fromPoints(start.end, end.start))
|
editor.selection.setSelectionRange(Range.fromPoints(start.end, end.start))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
@ -299,28 +299,28 @@ module.exports = {
|
||||||
case "(":
|
case "(":
|
||||||
case "{":
|
case "{":
|
||||||
case "[":
|
case "[":
|
||||||
var cursor = editor.getCursorPosition()
|
var cursor = editor.getCursorPosition();
|
||||||
var end = editor.session.$findClosingBracket(param, cursor, /paren/)
|
var end = editor.session.$findClosingBracket(param, cursor, /paren/);
|
||||||
if (!end)
|
if (!end)
|
||||||
return
|
return;
|
||||||
var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/)
|
var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/);
|
||||||
if (!start)
|
if (!start)
|
||||||
return
|
return;
|
||||||
end.column ++;
|
end.column ++;
|
||||||
editor.selection.setSelectionRange(Range.fromPoints(start, end))
|
editor.selection.setSelectionRange(Range.fromPoints(start, end));
|
||||||
break
|
break;
|
||||||
case "'":
|
case "'":
|
||||||
case "\"":
|
case "\"":
|
||||||
case "/":
|
case "/":
|
||||||
var end = find(editor, param, 1)
|
var end = find(editor, param, 1);
|
||||||
if (!end)
|
if (!end)
|
||||||
return
|
return;
|
||||||
var start = find(editor, param, -1)
|
var start = find(editor, param, -1);
|
||||||
if (!start)
|
if (!start)
|
||||||
return
|
return;
|
||||||
end.column ++;
|
end.column ++;
|
||||||
editor.selection.setSelectionRange(Range.fromPoints(start.start, end.end))
|
editor.selection.setSelectionRange(Range.fromPoints(start.start, end.end));
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -528,19 +528,19 @@ module.exports = {
|
||||||
"%": new Motion(function(editor){
|
"%": new Motion(function(editor){
|
||||||
var brRe = /[\[\]{}()]/g;
|
var brRe = /[\[\]{}()]/g;
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var ch = editor.session.getLine(cursor.row)[cursor.column]
|
var ch = editor.session.getLine(cursor.row)[cursor.column];
|
||||||
if (!brRe.test(ch)){
|
if (!brRe.test(ch)) {
|
||||||
var range = find(editor, brRe)
|
var range = find(editor, brRe);
|
||||||
if (!range)
|
if (!range)
|
||||||
return
|
return;
|
||||||
cursor = range.start
|
cursor = range.start;
|
||||||
}
|
}
|
||||||
var match = editor.session.findMatchingBracket({
|
var match = editor.session.findMatchingBracket({
|
||||||
row: cursor.row,
|
row: cursor.row,
|
||||||
column: cursor.column + 1
|
column: cursor.column + 1
|
||||||
});
|
});
|
||||||
|
|
||||||
return match
|
return match;
|
||||||
}),
|
}),
|
||||||
"ctrl-d": {
|
"ctrl-d": {
|
||||||
nav: function(editor, range, count, param) {
|
nav: function(editor, range, count, param) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue