@@ -1141,9 +1141,11 @@ define(function (require, exports, module) {
11411141 * @param {{line:number, ch:number}= } end If not specified, defaults to start.
11421142 * @param {boolean } center true to center the viewport
11431143 * @param {number } centerOptions Option value, or 0 for no options; one of the BOUNDARY_* constants above.
1144+ * @param {?string } origin An optional string that describes what other selection or edit operations this
1145+ * should be merged with for the purposes of undo. See Document.replaceRange() for more details.
11441146 */
1145- Editor . prototype . setSelection = function ( start , end , center , centerOptions ) {
1146- this . setSelections ( [ { start : start , end : end || start } ] , center , centerOptions ) ;
1147+ Editor . prototype . setSelection = function ( start , end , center , centerOptions , origin ) {
1148+ this . setSelections ( [ { start : start , end : end || start } ] , center , centerOptions , origin ) ;
11471149 } ;
11481150
11491151 /**
@@ -1158,15 +1160,20 @@ define(function (require, exports, module) {
11581160 * one selection has primary set to true. If none has primary set to true, the last one is primary.
11591161 * @param {boolean } center true to center the viewport around the primary selection.
11601162 * @param {number } centerOptions Option value, or 0 for no options; one of the BOUNDARY_* constants above.
1163+ * @param {?string } origin An optional string that describes what other selection or edit operations this
1164+ * should be merged with for the purposes of undo. See Document.replaceRange() for more details.
11611165 */
1162- Editor . prototype . setSelections = function ( selections , center , centerOptions ) {
1163- var primIndex = selections . length - 1 ;
1166+ Editor . prototype . setSelections = function ( selections , center , centerOptions , origin ) {
1167+ var primIndex = selections . length - 1 , options ;
1168+ if ( origin ) {
1169+ options = { origin : origin } ;
1170+ }
11641171 this . _codeMirror . setSelections ( _ . map ( selections , function ( sel , index ) {
11651172 if ( sel . primary ) {
11661173 primIndex = index ;
11671174 }
11681175 return { anchor : sel . reversed ? sel . end : sel . start , head : sel . reversed ? sel . start : sel . end } ;
1169- } ) , primIndex ) ;
1176+ } ) , primIndex , options ) ;
11701177 if ( center ) {
11711178 this . centerOnCursor ( centerOptions ) ;
11721179 }
0 commit comments