!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/edit/matchbrackets")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(h){"use strict";var r=h.commands,C=h.Pos;function t(d,m){d.extendSelectionsBy(function(e){if(d.display.shift||d.doc.extend||e.empty()){var t=d.doc,n=e.head,r=m;if(r<0&&0==n.ch)return t.clipPos(C(n.line-1));var o=t.getLine(n.line);if(0=o.length)return t.clipPos(C(n.line+1,0));for(var i,l="start",s=n.ch,a=s,c=r<0?0:o.length;a!=c;a+=r){var f=o.charAt(r<0?a-1:a),u="_"!=f&&h.isWordChar(f)?"w":"o";if("w"==u&&f.toUpperCase()==f&&(u="W"),"start"==l)"o"!=u?(l="in",i=u):s=a+r;else if("in"==l&&i!=u){if("w"==i&&"W"==u&&r<0&&a--,"W"==i&&"w"==u&&0=t&&e.execCommand("goLineUp")),e.scrollTo(null,n.top-e.defaultTextHeight())},r.scrollLineDown=function(e){var t,n=e.getScrollInfo();e.somethingSelected()||(t=e.lineAtHeight(n.top,"local")+1,e.getCursor().line<=t&&e.execCommand("goLineDown")),e.scrollTo(null,n.top+e.defaultTextHeight())},r.splitSelectionByLine=function(e){for(var t=e.listSelections(),n=[],r=0;ro.line&&l==i.line&&0==i.ch||n.push({anchor:l==o.line?o:C(l,0),head:l==i.line?i:C(l)});e.setSelections(n,0)},r.singleSelectionTop=function(e){var t=e.listSelections()[0];e.setSelection(t.anchor,t.head,{scroll:!1})},r.selectLine=function(e){for(var t=e.listSelections(),n=[],r=0;ro.lastLine()?o.replaceRange("\n"+r,C(o.lastLine()),null,"+swapLine"):o.replaceRange(r+"\n",C(n,0),null,"+swapLine")}o.setSelections(l),o.scrollIntoView()})},r.swapLineDown=function(o){if(o.isReadOnly())return h.Pass;for(var e=o.listSelections(),i=[],t=o.lastLine()+1,n=e.length-1;0<=n;n--){var r=e[n],l=r.to().line+1,s=r.from().line;0!=r.to().ch||r.empty()||l--,l