fix weird pairing of quotes in cstyle behavior
This commit is contained in:
parent
2d06dc6316
commit
c356c14940
2 changed files with 18 additions and 4 deletions
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
if (typeof process !== "undefined") {
|
if (typeof process !== "undefined") {
|
||||||
require("amd-loader");
|
require("amd-loader");
|
||||||
|
require("../../test/mockdom");
|
||||||
}
|
}
|
||||||
|
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
|
|
@ -117,9 +118,9 @@ module.exports = {
|
||||||
|
|
||||||
editor.setValue("");
|
editor.setValue("");
|
||||||
exec("insertstring", 1, "{");
|
exec("insertstring", 1, "{");
|
||||||
assert.equal(editor.getValue(), "{")
|
assert.equal(editor.getValue(), "{");
|
||||||
exec("insertstring", 1, "\n");
|
exec("insertstring", 1, "\n");
|
||||||
assert.equal(editor.getValue(), "{\n \n}")
|
assert.equal(editor.getValue(), "{\n \n}");
|
||||||
|
|
||||||
editor.setValue("");
|
editor.setValue("");
|
||||||
exec("insertstring", 1, "(");
|
exec("insertstring", 1, "(");
|
||||||
|
|
@ -129,6 +130,19 @@ module.exports = {
|
||||||
exec("backspace", 1);
|
exec("backspace", 1);
|
||||||
exec("insertstring", 1, '"');
|
exec("insertstring", 1, '"');
|
||||||
assert.equal(editor.getValue(), '("")');
|
assert.equal(editor.getValue(), '("")');
|
||||||
|
|
||||||
|
editor.setValue("('foo')", 1);
|
||||||
|
exec("gotoleft", 1);
|
||||||
|
exec("selectleft", 1);
|
||||||
|
exec("selectMoreBefore", 1);
|
||||||
|
exec("insertstring", 1, "'");
|
||||||
|
assert.equal(editor.getValue(), "('foo')");
|
||||||
|
exec("selectleft", 1);
|
||||||
|
exec("insertstring", 1, '"');
|
||||||
|
assert.equal(editor.getValue(), '("foo")');
|
||||||
|
exec("selectleft", 1);
|
||||||
|
exec("insertstring", 1, '"');
|
||||||
|
assert.equal(editor.getValue(), '("foo")');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -256,7 +256,7 @@ var CstyleBehaviour = function() {
|
||||||
text: quote + selected + quote,
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
};
|
};
|
||||||
} else {
|
} else if (!selected) {
|
||||||
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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue