Make sure wrapping behaves the same as before
This commit is contained in:
parent
6338bd10f3
commit
72dde40c76
1 changed files with 3 additions and 9 deletions
|
|
@ -88,8 +88,6 @@ var CstyleBehaviour = function () {
|
|||
|
||||
this.add("braces", "insertion", function (state, action, editor, session, text) {
|
||||
if (text == '{') {
|
||||
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
||||
return;
|
||||
var selection = editor.getSelectionRange();
|
||||
var selected = session.doc.getTextRange(selection);
|
||||
if (selected !== "" && selected !== "{") {
|
||||
|
|
@ -97,7 +95,7 @@ var CstyleBehaviour = function () {
|
|||
text: '{' + selected + '}',
|
||||
selection: false
|
||||
};
|
||||
} else {
|
||||
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
||||
return {
|
||||
text: '{}',
|
||||
|
|
@ -152,8 +150,6 @@ var CstyleBehaviour = function () {
|
|||
|
||||
this.add("parens", "insertion", function (state, action, editor, session, text) {
|
||||
if (text == '(') {
|
||||
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
||||
return;
|
||||
var selection = editor.getSelectionRange();
|
||||
var selected = session.doc.getTextRange(selection);
|
||||
if (selected !== "") {
|
||||
|
|
@ -161,7 +157,7 @@ var CstyleBehaviour = function () {
|
|||
text: '(' + selected + ')',
|
||||
selection: false
|
||||
};
|
||||
} else {
|
||||
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
||||
return {
|
||||
text: '()',
|
||||
|
|
@ -199,8 +195,6 @@ var CstyleBehaviour = function () {
|
|||
|
||||
this.add("brackets", "insertion", function (state, action, editor, session, text) {
|
||||
if (text == '[') {
|
||||
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
||||
return;
|
||||
var selection = editor.getSelectionRange();
|
||||
var selected = session.doc.getTextRange(selection);
|
||||
if (selected !== "") {
|
||||
|
|
@ -208,7 +202,7 @@ var CstyleBehaviour = function () {
|
|||
text: '[' + selected + ']',
|
||||
selection: false
|
||||
};
|
||||
} else {
|
||||
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
||||
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
||||
return {
|
||||
text: '[]',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue