Check for sane quote insertion at the latest possible point
This commit is contained in:
parent
45d7c6a7ee
commit
67fe548347
1 changed files with 3 additions and 1 deletions
|
|
@ -249,7 +249,7 @@ var CstyleBehaviour = function () {
|
||||||
text: quote + selected + quote,
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
};
|
};
|
||||||
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
var leftChar = line.substring(cursor.column-1, cursor.column);
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
||||||
|
|
@ -279,6 +279,8 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
|
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
||||||
|
return;
|
||||||
return {
|
return {
|
||||||
text: quote + quote,
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue