mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge branch 'sk-auto-pair-braces' into sk-ac-improvements-integration
This commit is contained in:
commit
b799bbc695
1 changed files with 0 additions and 26 deletions
|
@ -452,17 +452,6 @@ LatexBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
||||||
context.autoInsertedBrackets++;
|
context.autoInsertedBrackets++;
|
||||||
};
|
};
|
||||||
|
|
||||||
LatexBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
|
||||||
var cursor = editor.getCursorPosition();
|
|
||||||
var line = session.doc.getLine(cursor.row);
|
|
||||||
if (!this.isMaybeInsertedClosing(cursor, line))
|
|
||||||
context.maybeInsertedBrackets = 0;
|
|
||||||
context.maybeInsertedRow = cursor.row;
|
|
||||||
context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
|
||||||
context.maybeInsertedLineEnd = line.substr(cursor.column);
|
|
||||||
context.maybeInsertedBrackets++;
|
|
||||||
};
|
|
||||||
|
|
||||||
LatexBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
LatexBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
||||||
return context.autoInsertedBrackets > 0 &&
|
return context.autoInsertedBrackets > 0 &&
|
||||||
cursor.row === context.autoInsertedRow &&
|
cursor.row === context.autoInsertedRow &&
|
||||||
|
@ -470,26 +459,11 @@ LatexBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
||||||
line.substr(cursor.column) === context.autoInsertedLineEnd;
|
line.substr(cursor.column) === context.autoInsertedLineEnd;
|
||||||
};
|
};
|
||||||
|
|
||||||
LatexBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
|
||||||
return context.maybeInsertedBrackets > 0 &&
|
|
||||||
cursor.row === context.maybeInsertedRow &&
|
|
||||||
line.substr(cursor.column) === context.maybeInsertedLineEnd &&
|
|
||||||
line.substr(0, cursor.column) == context.maybeInsertedLineStart;
|
|
||||||
};
|
|
||||||
|
|
||||||
LatexBehaviour.popAutoInsertedClosing = function() {
|
LatexBehaviour.popAutoInsertedClosing = function() {
|
||||||
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
|
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
|
||||||
context.autoInsertedBrackets--;
|
context.autoInsertedBrackets--;
|
||||||
};
|
};
|
||||||
|
|
||||||
LatexBehaviour.clearMaybeInsertedClosing = function() {
|
|
||||||
if (context) {
|
|
||||||
context.maybeInsertedBrackets = 0;
|
|
||||||
context.maybeInsertedRow = -1;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
oop.inherits(LatexBehaviour, Behaviour);
|
oop.inherits(LatexBehaviour, Behaviour);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue