@@ -1130,9 +1130,11 @@ define(function (require, exports, module) {
11301130 * @param {{line:number, ch:number}= } end If not specified, defaults to start.
11311131 * @param {boolean } center true to center the viewport
11321132 * @param {number } centerOptions Option value, or 0 for no options; one of the BOUNDARY_* constants above.
1133+ * @param {?string } origin An optional string that describes what other selection or edit operations this
1134+ * should be merged with for the purposes of undo. See Document.replaceRange() for more details.
11331135 */
1134- Editor . prototype . setSelection = function ( start , end , center , centerOptions ) {
1135- this . setSelections ( [ { start : start , end : end || start } ] , center , centerOptions ) ;
1136+ Editor . prototype . setSelection = function ( start , end , center , centerOptions , origin ) {
1137+ this . setSelections ( [ { start : start , end : end || start } ] , center , centerOptions , origin ) ;
11361138 } ;
11371139
11381140 /**
@@ -1147,15 +1149,20 @@ define(function (require, exports, module) {
11471149 * one selection has primary set to true. If none has primary set to true, the last one is primary.
11481150 * @param {boolean } center true to center the viewport around the primary selection.
11491151 * @param {number } centerOptions Option value, or 0 for no options; one of the BOUNDARY_* constants above.
1152+ * @param {?string } origin An optional string that describes what other selection or edit operations this
1153+ * should be merged with for the purposes of undo. See Document.replaceRange() for more details.
11501154 */
1151- Editor . prototype . setSelections = function ( selections , center , centerOptions ) {
1152- var primIndex ;
1155+ Editor . prototype . setSelections = function ( selections , center , centerOptions , origin ) {
1156+ var primIndex , options ;
1157+ if ( origin ) {
1158+ options = { origin : origin } ;
1159+ }
11531160 this . _codeMirror . setSelections ( _ . map ( selections , function ( sel , index ) {
11541161 if ( sel . primary ) {
11551162 primIndex = index ;
11561163 }
11571164 return { anchor : sel . reversed ? sel . end : sel . start , head : sel . reversed ? sel . start : sel . end } ;
1158- } ) , primIndex ) ;
1165+ } ) , primIndex , options ) ;
11591166 if ( center ) {
11601167 this . centerOnCursor ( centerOptions ) ;
11611168 }
0 commit comments