Skip to content

Commit

Permalink
convert multi_select to an option
Browse files Browse the repository at this point in the history
nightwing committed Jul 19, 2013
1 parent e5ce9e7 commit e0ce741
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions lib/ace/multi_select.js
Original file line number Diff line number Diff line change
@@ -867,13 +867,16 @@ exports.onSessionChange = function(e) {
// adds multiple selection support to the editor
// (note: should be called only once for each editor instance)
function MultiSelect(editor) {
if (editor.$multiselectOnSessionChange)
return;
editor.$onAddRange = editor.$onAddRange.bind(editor);
editor.$onRemoveRange = editor.$onRemoveRange.bind(editor);
editor.$onMultiSelect = editor.$onMultiSelect.bind(editor);
editor.$onSingleSelect = editor.$onSingleSelect.bind(editor);
editor.$multiselectOnSessionChange = exports.onSessionChange.bind(editor);

exports.onSessionChange.call(editor, editor);
editor.on("changeSession", exports.onSessionChange.bind(editor));
editor.$multiselectOnSessionChange(editor);
editor.on("changeSession", editor.$multiselectOnSessionChange);

editor.on("mousedown", onMouseDown);
editor.commands.addCommands(commands.defaultCommands);
@@ -908,4 +911,23 @@ function addAltCursorListeners(editor){

exports.MultiSelect = MultiSelect;


require("./config").defineOptions(Editor.prototype, "editor", {
enableMultiselect: {
set: function(val) {
MultiSelect(this);
if (val) {
this.on("changeSession", this.$multiselectOnSessionChange);
this.on("mousedown", onMouseDown);
} else {
this.off("changeSession", this.$multiselectOnSessionChange);
this.off("mousedown", onMouseDown);
}
},
value: true
}
})



});

0 comments on commit e0ce741

Please sign in to comment.