Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3820)

Unified Diff: chrome_linux/resources/inspector/CodeMirrorTextEditor.js

Issue 310483004: Roll reference builds to 35.0.1916.114. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/reference_builds/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome_linux/resources/inspector/AuditsPanel.js ('k') | chrome_linux/resources/inspector/ConsolePanel.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_linux/resources/inspector/CodeMirrorTextEditor.js
===================================================================
--- chrome_linux/resources/inspector/CodeMirrorTextEditor.js (revision 273864)
+++ chrome_linux/resources/inspector/CodeMirrorTextEditor.js (working copy)
@@ -1,14 +1,15 @@
-window.CodeMirror=(function(){"use strict";var gecko=/gecko\/\d/i.test(navigator.userAgent);var ie=/MSIE \d/.test(navigator.userAgent);var ie_lt8=ie&&(document.documentMode==null||document.documentMode<8);var ie_lt9=ie&&(document.documentMode==null||document.documentMode<9);var ie_gt10=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent);var webkit=/WebKit\//.test(navigator.userAgent);var qtwebkit=webkit&&/Qt\/\d+\.\d+/.test(navigator.userAgent);var chrome=/Chrome\//.test(navigator.userAgent);var opera=/Opera\//.test(navigator.userAgent);var safari=/Apple Computer/.test(navigator.vendor);var khtml=/KHTML\//.test(navigator.userAgent);var mac_geLion=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent);var mac_geMountainLion=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent);var phantom=/PhantomJS/.test(navigator.userAgent);var ios=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent);var mobile=ios||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent);var mac=ios||/Mac/.test(navigator.platform);var windows=/win/i.test(navigator.platform);var opera_version=opera&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);if(opera_version)opera_version=Number(opera_version[1]);if(opera_version&&opera_version>=15){opera=false;webkit=true;}
-var flipCtrlCmd=mac&&(qtwebkit||opera&&(opera_version==null||opera_version<12.11));var captureMiddleClick=gecko||(ie&&!ie_lt9);var sawReadOnlySpans=false,sawCollapsedSpans=false;function CodeMirror(place,options){if(!(this instanceof CodeMirror))return new CodeMirror(place,options);this.options=options=options||{};for(var opt in defaults)if(!options.hasOwnProperty(opt)&&defaults.hasOwnProperty(opt))
-options[opt]=defaults[opt];setGuttersForLineNumbers(options);var docStart=typeof options.value=="string"?0:options.value.first;var display=this.display=makeDisplay(place,docStart);display.wrapper.CodeMirror=this;updateGutters(this);if(options.autofocus&&!mobile)focusInput(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,focused:false,suppressEdits:false,pasteIncoming:false,draggingText:false,highlight:new Delayed()};themeChanged(this);if(options.lineWrapping)
-this.display.wrapper.className+=" CodeMirror-wrap";var doc=options.value;if(typeof doc=="string")doc=new Doc(options.value,options.mode);operation(this,attachDoc)(this,doc);if(ie)setTimeout(bind(resetInput,this,true),20);registerEventHandlers(this);var hasFocus;try{hasFocus=(document.activeElement==display.input);}catch(e){}
+window.CodeMirror=(function(){"use strict";var gecko=/gecko\/\d/i.test(navigator.userAgent);var old_ie=/MSIE \d/.test(navigator.userAgent);var ie_lt8=old_ie&&(document.documentMode==null||document.documentMode<8);var ie_lt9=old_ie&&(document.documentMode==null||document.documentMode<9);var ie_gt10=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent);var ie=old_ie||ie_gt10;var webkit=/WebKit\//.test(navigator.userAgent);var qtwebkit=webkit&&/Qt\/\d+\.\d+/.test(navigator.userAgent);var chrome=/Chrome\//.test(navigator.userAgent);var opera=/Opera\//.test(navigator.userAgent);var safari=/Apple Computer/.test(navigator.vendor);var khtml=/KHTML\//.test(navigator.userAgent);var mac_geLion=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent);var mac_geMountainLion=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent);var phantom=/PhantomJS/.test(navigator.userAgent);var ios=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent);var mobile=ios||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent);var mac=ios||/Mac/.test(navigator.platform);var windows=/win/i.test(navigator.platform);var opera_version=opera&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);if(opera_version)opera_version=Number(opera_version[1]);if(opera_version&&opera_version>=15){opera=false;webkit=true;}
+var flipCtrlCmd=mac&&(qtwebkit||opera&&(opera_version==null||opera_version<12.11));var captureMiddleClick=gecko||(old_ie&&!ie_lt9);var sawReadOnlySpans=false,sawCollapsedSpans=false;function CodeMirror(place,options){if(!(this instanceof CodeMirror))return new CodeMirror(place,options);this.options=options=options||{};for(var opt in defaults)if(!options.hasOwnProperty(opt)&&defaults.hasOwnProperty(opt))
+options[opt]=defaults[opt];setGuttersForLineNumbers(options);var docStart=typeof options.value=="string"?0:options.value.first;var display=this.display=makeDisplay(place,docStart);display.wrapper.CodeMirror=this;updateGutters(this);if(options.autofocus&&!mobile)focusInput(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,focused:false,suppressEdits:false,pasteIncoming:false,cutIncoming:false,draggingText:false,highlight:new Delayed()};themeChanged(this);if(options.lineWrapping)
+this.display.wrapper.className+=" CodeMirror-wrap";var doc=options.value;if(typeof doc=="string")doc=new Doc(options.value,options.mode);operation(this,attachDoc)(this,doc);if(old_ie)setTimeout(bind(resetInput,this,true),20);registerEventHandlers(this);var hasFocus;try{hasFocus=(document.activeElement==display.input);}catch(e){}
if(hasFocus||(options.autofocus&&!mobile))setTimeout(bind(onFocus,this),20);else onBlur(this);operation(this,function(){for(var opt in optionHandlers)
if(optionHandlers.propertyIsEnumerable(opt))
optionHandlers[opt](this,options[opt],Init);for(var i=0;i<initHooks.length;++i)initHooks[i](this);})();}
function makeDisplay(place,docStart){var d={};var input=d.input=elt("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");if(webkit)input.style.width="1000px";else input.setAttribute("wrap","off");if(ios)input.style.border="1px solid black";input.setAttribute("autocorrect","off");input.setAttribute("autocapitalize","off");input.setAttribute("spellcheck","false");d.inputDiv=elt("div",[input],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");d.scrollbarH=elt("div",[elt("div",null,null,"height: 1px")],"CodeMirror-hscrollbar");d.scrollbarV=elt("div",[elt("div",null,null,"width: 1px")],"CodeMirror-vscrollbar");d.scrollbarFiller=elt("div",null,"CodeMirror-scrollbar-filler");d.gutterFiller=elt("div",null,"CodeMirror-gutter-filler");d.lineDiv=elt("div",null,"CodeMirror-code");d.selectionDiv=elt("div",null,null,"position: relative; z-index: 1");d.cursor=elt("div","\u00a0","CodeMirror-cursor");d.otherCursor=elt("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor");d.measure=elt("div",null,"CodeMirror-measure");d.lineSpace=elt("div",[d.measure,d.selectionDiv,d.lineDiv,d.cursor,d.otherCursor],null,"position: relative; outline: none");d.mover=elt("div",[elt("div",[d.lineSpace],"CodeMirror-lines")],null,"position: relative");d.sizer=elt("div",[d.mover],"CodeMirror-sizer");d.heightForcer=elt("div",null,null,"position: absolute; height: "+scrollerCutOff+"px; width: 1px;");d.gutters=elt("div",null,"CodeMirror-gutters");d.lineGutter=null;d.scroller=elt("div",[d.sizer,d.heightForcer,d.gutters],"CodeMirror-scroll");d.scroller.setAttribute("tabIndex","-1");d.wrapper=elt("div",[d.inputDiv,d.scrollbarH,d.scrollbarV,d.scrollbarFiller,d.gutterFiller,d.scroller],"CodeMirror");if(ie_lt8){d.gutters.style.zIndex=-1;d.scroller.style.paddingRight=0;}
if(place.appendChild)place.appendChild(d.wrapper);else place(d.wrapper);if(ios)input.style.width="0px";if(!webkit)d.scroller.draggable=true;if(khtml){d.inputDiv.style.height="1px";d.inputDiv.style.position="absolute";}
else if(ie_lt8)d.scrollbarH.style.minWidth=d.scrollbarV.style.minWidth="18px";d.viewOffset=d.lastSizeC=0;d.showingFrom=d.showingTo=docStart;d.lineNumWidth=d.lineNumInnerWidth=d.lineNumChars=null;d.prevInput="";d.alignWidgets=false;d.pollingFast=false;d.poll=new Delayed();d.cachedCharWidth=d.cachedTextHeight=null;d.measureLineCache=[];d.measureLineCachePos=0;d.inaccurateSelection=false;d.maxLine=null;d.maxLineLength=0;d.maxLineChanged=false;d.wheelDX=d.wheelDY=d.wheelStartX=d.wheelStartY=null;return d;}
-function loadMode(cm){cm.doc.mode=CodeMirror.getMode(cm.options,cm.doc.modeOption);cm.doc.iter(function(line){if(line.stateAfter)line.stateAfter=null;if(line.styles)line.styles=null;});cm.doc.frontier=cm.doc.first;startWorker(cm,100);cm.state.modeGen++;if(cm.curOp)regChange(cm);}
+function loadMode(cm){cm.doc.mode=CodeMirror.getMode(cm.options,cm.doc.modeOption);resetModeState(cm);}
+function resetModeState(cm){cm.doc.iter(function(line){if(line.stateAfter)line.stateAfter=null;if(line.styles)line.styles=null;});cm.doc.frontier=cm.doc.first;startWorker(cm,100);cm.state.modeGen++;if(cm.curOp)regChange(cm);}
function wrappingChanged(cm){if(cm.options.lineWrapping){cm.display.wrapper.className+=" CodeMirror-wrap";cm.display.sizer.style.minWidth="";}else{cm.display.wrapper.className=cm.display.wrapper.className.replace(" CodeMirror-wrap","");computeMaxLength(cm);}
estimateLineHeights(cm);regChange(cm);clearCaches(cm);setTimeout(function(){updateScrollbars(cm);},100);}
function estimateHeight(cm){var th=textHeight(cm.display),wrapping=cm.options.lineWrapping;var perLine=wrapping&&Math.max(5,cm.display.scroller.clientWidth/charWidth(cm.display)-3);return function(line){if(lineIsHidden(cm.doc,line))
@@ -17,7 +18,7 @@
return th;};}
function estimateLineHeights(cm){var doc=cm.doc,est=estimateHeight(cm);doc.iter(function(line){var estHeight=est(line);if(estHeight!=line.height)updateLineHeight(line,estHeight);});}
function keyMapChanged(cm){var map=keyMap[cm.options.keyMap],style=map.style;cm.display.wrapper.className=cm.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+
-(style?" cm-keymap-"+style:"");cm.state.disableInput=map.disableInput;}
+(style?" cm-keymap-"+style:"");}
function themeChanged(cm){cm.display.wrapper.className=cm.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+
cm.options.theme.replace(/(^|\s)\s*/g," cm-s-");clearCaches(cm);}
function guttersChanged(cm){updateGutters(cm);regChange(cm);setTimeout(function(){alignHorizontally(cm);},20);}
@@ -28,7 +29,7 @@
return len;}
function computeMaxLength(cm){var d=cm.display,doc=cm.doc;d.maxLine=getLine(doc,doc.first);d.maxLineLength=lineLength(doc,d.maxLine);d.maxLineChanged=true;doc.iter(function(line){var len=lineLength(doc,line);if(len>d.maxLineLength){d.maxLineLength=len;d.maxLine=line;}});}
function setGuttersForLineNumbers(options){var found=indexOf(options.gutters,"CodeMirror-linenumbers");if(found==-1&&options.lineNumbers){options.gutters=options.gutters.concat(["CodeMirror-linenumbers"]);}else if(found>-1&&!options.lineNumbers){options.gutters=options.gutters.slice(0);options.gutters.splice(found,1);}}
-function updateScrollbars(cm){var d=cm.display,docHeight=cm.doc.height;var totalHeight=docHeight+paddingVert(d);d.sizer.style.minHeight=d.heightForcer.style.top=totalHeight+"px";d.gutters.style.height=Math.max(totalHeight,d.scroller.clientHeight-scrollerCutOff)+"px";var scrollHeight=Math.max(totalHeight,d.scroller.scrollHeight);var needsH=d.scroller.scrollWidth>(d.scroller.clientWidth+1);var needsV=scrollHeight>(d.scroller.clientHeight+1);if(needsV){d.scrollbarV.style.display="block";d.scrollbarV.style.bottom=needsH?scrollbarWidth(d.measure)+"px":"0";d.scrollbarV.firstChild.style.height=(scrollHeight-d.scroller.clientHeight+d.scrollbarV.clientHeight)+"px";}else{d.scrollbarV.style.display="";d.scrollbarV.firstChild.style.height="0";}
+function updateScrollbars(cm){var d=cm.display,docHeight=cm.doc.height;var totalHeight=docHeight+paddingVert(d);d.sizer.style.minHeight=d.heightForcer.style.top=totalHeight+"px";d.gutters.style.height=Math.max(totalHeight,d.scroller.clientHeight-scrollerCutOff)+"px";var scrollHeight=Math.max(totalHeight,d.scroller.scrollHeight);var needsH=d.scroller.scrollWidth>(d.scroller.clientWidth+1);var needsV=scrollHeight>(d.scroller.clientHeight+1);if(needsV){d.scrollbarV.style.display="block";d.scrollbarV.style.bottom=needsH?scrollbarWidth(d.measure)+"px":"0";d.scrollbarV.firstChild.style.height=Math.max(0,scrollHeight-d.scroller.clientHeight+d.scrollbarV.clientHeight)+"px";}else{d.scrollbarV.style.display="";d.scrollbarV.firstChild.style.height="0";}
if(needsH){d.scrollbarH.style.display="block";d.scrollbarH.style.right=needsV?scrollbarWidth(d.measure)+"px":"0";d.scrollbarH.firstChild.style.width=(d.scroller.scrollWidth-d.scroller.clientWidth+d.scrollbarH.clientWidth)+"px";}else{d.scrollbarH.style.display="";d.scrollbarH.firstChild.style.width="0";}
if(needsH&&needsV){d.scrollbarFiller.style.display="block";d.scrollbarFiller.style.height=d.scrollbarFiller.style.width=scrollbarWidth(d.measure)+"px";}else d.scrollbarFiller.style.display="";if(needsH&&cm.options.coverGutterNextToScrollbar&&cm.options.fixedGutter){d.gutterFiller.style.display="block";d.gutterFiller.style.height=scrollbarWidth(d.measure)+"px";d.gutterFiller.style.width=d.gutters.offsetWidth+"px";}else d.gutterFiller.style.display="";if(mac_geLion&&scrollbarWidth(d.measure)===0){d.scrollbarV.style.minWidth=d.scrollbarH.style.minHeight=mac_geMountainLion?"18px":"12px";d.scrollbarV.style.pointerEvents=d.scrollbarH.style.pointerEvents="none";}}
function visibleLines(display,doc,viewPort){var top=display.scroller.scrollTop,height=display.wrapper.clientHeight;if(typeof viewPort=="number")top=viewPort;else if(viewPort){top=viewPort.top;height=viewPort.bottom-viewPort.top;}
@@ -47,7 +48,7 @@
if(updated){signalLater(cm,"update",cm);if(cm.display.showingFrom!=oldFrom||cm.display.showingTo!=oldTo)
signalLater(cm,"viewportChange",cm,cm.display.showingFrom,cm.display.showingTo);}
return updated;}
-function updateDisplayInner(cm,changes,visible,forced){var display=cm.display,doc=cm.doc;if(!display.wrapper.clientWidth){display.showingFrom=display.showingTo=doc.first;display.viewOffset=0;return;}
+function updateDisplayInner(cm,changes,visible,forced){var display=cm.display,doc=cm.doc;if(!display.wrapper.offsetWidth){display.showingFrom=display.showingTo=doc.first;display.viewOffset=0;return;}
if(!forced&&changes.length==0&&visible.from>display.showingFrom&&visible.to<display.showingTo)
return;if(maybeUpdateLineNumberWidth(cm))
changes=[{from:doc.first,to:doc.first+doc.size}];var gutterW=display.sizer.style.marginLeft=display.gutters.offsetWidth+"px";display.scrollbarH.style.left=cm.options.fixedGutter?gutterW:"0";var positionsChangedFrom=Infinity;if(cm.options.lineNumbers)
@@ -60,7 +61,7 @@
if(!forced&&intactLines==to-from&&from==display.showingFrom&&to==display.showingTo){updateViewOffset(cm);return;}
intact.sort(function(a,b){return a.from-b.from;});try{var focused=document.activeElement;}catch(e){}
if(intactLines<(to-from)*.7)display.lineDiv.style.display="none";patchDisplay(cm,from,to,intact,positionsChangedFrom);display.lineDiv.style.display="";if(focused&&document.activeElement!=focused&&focused.offsetHeight)focused.focus();var different=from!=display.showingFrom||to!=display.showingTo||display.lastSizeC!=display.wrapper.clientHeight;if(different){display.lastSizeC=display.wrapper.clientHeight;startWorker(cm,400);}
-display.showingFrom=from;display.showingTo=to;updateHeightsInViewport(cm);updateViewOffset(cm);return true;}
+display.showingFrom=from;display.showingTo=to;display.gutters.style.height="";updateHeightsInViewport(cm);updateViewOffset(cm);return true;}
function updateHeightsInViewport(cm){var display=cm.display;var prevBottom=display.lineDiv.offsetTop;for(var node=display.lineDiv.firstChild,height;node;node=node.nextSibling)if(node.lineObj){if(ie_lt8){var bot=node.offsetTop+node.offsetHeight;height=bot-prevBottom;prevBottom=bot;}else{var box=getRect(node);height=box.bottom-box.top;}
var diff=node.lineObj.height-height;if(height<2)height=textHeight(display);if(diff>.001||diff<-.001){updateLineHeight(node.lineObj,height);var widgets=node.lineObj.widgets;if(widgets)for(var i=0;i<widgets.length;++i)
widgets[i].height=widgets[i].node.offsetHeight;}}}
@@ -88,8 +89,8 @@
reuse.insertBefore(lineElement,insertBefore);if(isOk&&widgetsSeen==line.widgets.length){wrap=reuse;reuse.className=line.wrapClass||"";}}
if(!wrap){wrap=elt("div",null,line.wrapClass,"position: relative");wrap.appendChild(lineElement);}
if(bgClass)
-wrap.insertBefore(elt("div",null,bgClass+" CodeMirror-linebackground"),wrap.firstChild);if(cm.options.lineNumbers||markers){var gutterWrap=wrap.insertBefore(elt("div",null,null,"position: absolute; left: "+
-(cm.options.fixedGutter?dims.fixedPos:-dims.gutterTotalWidth)+"px"),wrap.firstChild);if(cm.options.fixedGutter)(wrap.alignable||(wrap.alignable=[])).push(gutterWrap);if(cm.options.lineNumbers&&(!markers||!markers["CodeMirror-linenumbers"]))
+wrap.insertBefore(elt("div",null,bgClass+" CodeMirror-linebackground"),wrap.firstChild);if(cm.options.lineNumbers||markers){var gutterWrap=wrap.insertBefore(elt("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+
+(cm.options.fixedGutter?dims.fixedPos:-dims.gutterTotalWidth)+"px"),lineElement);if(cm.options.fixedGutter)(wrap.alignable||(wrap.alignable=[])).push(gutterWrap);if(cm.options.lineNumbers&&(!markers||!markers["CodeMirror-linenumbers"]))
wrap.lineNumber=gutterWrap.appendChild(elt("div",lineNumberFor(cm.options,lineNo),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+dims.gutterLeft["CodeMirror-linenumbers"]+"px; width: "
+display.lineNumInnerWidth+"px"));if(markers)
for(var k=0;k<cm.options.gutters.length;++k){var id=cm.options.gutters[k],found=markers.hasOwnProperty(id)&&markers[id];if(found)
@@ -143,7 +144,7 @@
function clearCachedMeasurement(cm,line){var exists=findCachedMeasurement(cm,line);if(exists)exists.text=exists.measure=exists.markedSpans=null;}
function measureLine(cm,line){var cached=findCachedMeasurement(cm,line);if(cached)return cached.measure;var measure=measureLineInner(cm,line);var cache=cm.display.measureLineCache;var memo={text:line.text,width:cm.display.scroller.clientWidth,markedSpans:line.markedSpans,measure:measure,classes:line.textClass+"|"+line.wrapClass};if(cache.length==16)cache[++cm.display.measureLineCachePos%16]=memo;else cache.push(memo);return measure;}
function measureLineInner(cm,line){if(!cm.options.lineWrapping&&line.text.length>=cm.options.crudeMeasuringFrom)
-return crudelyMeasureLine(cm,line);var display=cm.display,measure=emptyArray(line.text.length);var pre=buildLineContent(cm,line,measure,true).pre;if(ie&&!ie_lt8&&!cm.options.lineWrapping&&pre.childNodes.length>100){var fragment=document.createDocumentFragment();var chunk=10,n=pre.childNodes.length;for(var i=0,chunks=Math.ceil(n/chunk);i<chunks;++i){var wrap=elt("div",null,null,"display: inline-block");for(var j=0;j<chunk&&n;++j){wrap.appendChild(pre.firstChild);--n;}
+return crudelyMeasureLine(cm,line);var display=cm.display,measure=emptyArray(line.text.length);var pre=buildLineContent(cm,line,measure,true).pre;if(old_ie&&!ie_lt8&&!cm.options.lineWrapping&&pre.childNodes.length>100){var fragment=document.createDocumentFragment();var chunk=10,n=pre.childNodes.length;for(var i=0,chunks=Math.ceil(n/chunk);i<chunks;++i){var wrap=elt("div",null,null,"display: inline-block");for(var j=0;j<chunk&&n;++j){wrap.appendChild(pre.firstChild);--n;}
fragment.appendChild(wrap);}
pre.appendChild(fragment);}
removeChildrenAndAdd(display.measure,pre);var outer=getRect(display.lineDiv);var vranges=[],data=emptyArray(line.text.length),maxBot=pre.offsetHeight;if(ie_lt9&&display.measure.first!=pre)
@@ -152,7 +153,7 @@
return{left:rect.left-outer.left,right:rect.right-outer.left,top:i,bottom:null};}
function finishRect(rect){rect.bottom=vranges[rect.top+1];rect.top=vranges[rect.top];}
for(var i=0,cur;i<measure.length;++i)if(cur=measure[i]){var node=cur,rect=null;if(/\bCodeMirror-widget\b/.test(cur.className)&&cur.getClientRects){if(cur.firstChild.nodeType==1)node=cur.firstChild;var rects=node.getClientRects();if(rects.length>1){rect=data[i]=measureRect(rects[0]);rect.rightSide=measureRect(rects[rects.length-1]);}}
-if(!rect)rect=data[i]=measureRect(getRect(node));if(cur.measureRight)rect.right=getRect(cur.measureRight).left;if(cur.leftSide)rect.leftSide=measureRect(getRect(cur.leftSide));}
+if(!rect)rect=data[i]=measureRect(getRect(node));if(cur.measureRight)rect.right=getRect(cur.measureRight).left-outer.left;if(cur.leftSide)rect.leftSide=measureRect(getRect(cur.leftSide));}
removeChildren(cm.display.measure);for(var i=0,cur;i<data.length;++i)if(cur=data[i]){finishRect(cur);if(cur.leftSide)finishRect(cur.leftSide);if(cur.rightSide)finishRect(cur.rightSide);}
return data;}
function crudelyMeasureLine(cm,line){var copy=new Line(line.text.slice(0,100),null);if(line.textClass)copy.textClass=line.textClass;var measure=measureLineInner(cm,copy);var left=measureChar(cm,copy,0,measure,"left");var right=measureChar(cm,copy,99,measure,"right");return{crude:true,top:left.top,left:left.left,bottom:left.bottom,width:(right.right-left.left)/100};}
@@ -178,7 +179,7 @@
lineNo=mergedPos.to.line;else
return found;}}
function coordsCharInner(cm,lineObj,lineNo,x,y){var innerOff=y-heightAtLine(cm,lineObj);var wrongLine=false,adjust=2*cm.display.wrapper.clientWidth;var measurement=measureLine(cm,lineObj);function getX(ch){var sp=cursorCoords(cm,Pos(lineNo,ch),"line",lineObj,measurement);wrongLine=true;if(innerOff>sp.bottom)return sp.left-adjust;else if(innerOff<sp.top)return sp.left+adjust;else wrongLine=false;return sp.left;}
-var bidi=getOrder(lineObj),dist=lineObj.text.length;var from=lineLeft(lineObj),to=lineRight(lineObj);var fromX=getX(from),fromOutside=wrongLine,toX=getX(to),toOutside=wrongLine;if(x>toX)return PosWithInfo(lineNo,to,toOutside,1);for(;;){if(bidi?to==from||to==moveVisually(lineObj,from,1):to-from<=1){var ch=x<fromX||x-fromX<=toX-x?from:to;var xDiff=x-(ch==from?fromX:toX);while(isExtendingChar.test(lineObj.text.charAt(ch)))++ch;var pos=PosWithInfo(lineNo,ch,ch==from?fromOutside:toOutside,xDiff<0?-1:xDiff?1:0);return pos;}
+var bidi=getOrder(lineObj),dist=lineObj.text.length;var from=lineLeft(lineObj),to=lineRight(lineObj);var fromX=getX(from),fromOutside=wrongLine,toX=getX(to),toOutside=wrongLine;if(x>toX)return PosWithInfo(lineNo,to,toOutside,1);for(;;){if(bidi?to==from||to==moveVisually(lineObj,from,1):to-from<=1){var ch=x<fromX||x-fromX<=toX-x?from:to;var xDiff=x-(ch==from?fromX:toX);while(isExtendingChar(lineObj.text.charAt(ch)))++ch;var pos=PosWithInfo(lineNo,ch,ch==from?fromOutside:toOutside,xDiff<0?-1:xDiff?1:0);return pos;}
var step=Math.ceil(dist/2),middle=from+step;if(bidi){middle=from;for(var i=0;i<step;++i)middle=moveVisually(lineObj,middle,1);}
var middleX=getX(middle);if(middleX>x){to=middle;toX=middleX;if(toOutside=wrongLine)toX+=1000;dist=step;}
else{from=middle;fromX=middleX;fromOutside=wrongLine;dist-=step;}}}
@@ -213,26 +214,29 @@
function fastPoll(cm){var missed=false;cm.display.pollingFast=true;function p(){var changed=readInput(cm);if(!changed&&!missed){missed=true;cm.display.poll.set(60,p);}
else{cm.display.pollingFast=false;slowPoll(cm);}}
cm.display.poll.set(20,p);}
-function readInput(cm){var input=cm.display.input,prevInput=cm.display.prevInput,doc=cm.doc,sel=doc.sel;if(!cm.state.focused||hasSelection(input)||isReadOnly(cm)||cm.state.disableInput)return false;if(cm.state.pasteIncoming&&cm.state.fakedLastChar){input.value=input.value.substring(0,input.value.length-1);cm.state.fakedLastChar=false;}
+function readInput(cm){var input=cm.display.input,prevInput=cm.display.prevInput,doc=cm.doc,sel=doc.sel;if(!cm.state.focused||hasSelection(input)||isReadOnly(cm)||cm.options.disableInput)return false;if(cm.state.pasteIncoming&&cm.state.fakedLastChar){input.value=input.value.substring(0,input.value.length-1);cm.state.fakedLastChar=false;}
var text=input.value;if(text==prevInput&&posEq(sel.from,sel.to))return false;if(ie&&!ie_lt9&&cm.display.inputHasSelection===text){resetInput(cm,true);return false;}
-var withOp=!cm.curOp;if(withOp)startOperation(cm);sel.shift=false;var same=0,l=Math.min(prevInput.length,text.length);while(same<l&&prevInput.charCodeAt(same)==text.charCodeAt(same))++same;var from=sel.from,to=sel.to;if(same<prevInput.length)
+var withOp=!cm.curOp;if(withOp)startOperation(cm);sel.shift=false;var same=0,l=Math.min(prevInput.length,text.length);while(same<l&&prevInput.charCodeAt(same)==text.charCodeAt(same))++same;var from=sel.from,to=sel.to;var inserted=text.slice(same);if(same<prevInput.length)
from=Pos(from.line,from.ch-(prevInput.length-same));else if(cm.state.overwrite&&posEq(from,to)&&!cm.state.pasteIncoming)
-to=Pos(to.line,Math.min(getLine(doc,to.line).text.length,to.ch+(text.length-same)));var updateInput=cm.curOp.updateInput;var changeEvent={from:from,to:to,text:splitLines(text.slice(same)),origin:cm.state.pasteIncoming?"paste":"+input"};makeChange(cm.doc,changeEvent,"end");cm.curOp.updateInput=updateInput;signalLater(cm,"inputRead",cm,changeEvent);if(text.length>1000||text.indexOf("\n")>-1)input.value=cm.display.prevInput="";else cm.display.prevInput=text;if(withOp)endOperation(cm);cm.state.pasteIncoming=false;return true;}
+to=Pos(to.line,Math.min(getLine(doc,to.line).text.length,to.ch+inserted.length));var updateInput=cm.curOp.updateInput;var changeEvent={from:from,to:to,text:splitLines(inserted),origin:cm.state.pasteIncoming?"paste":cm.state.cutIncoming?"cut":"+input"};makeChange(cm.doc,changeEvent,"end");cm.curOp.updateInput=updateInput;signalLater(cm,"inputRead",cm,changeEvent);if(inserted&&!cm.state.pasteIncoming&&cm.options.electricChars&&cm.options.smartIndent&&sel.head.ch<100){var electric=cm.getModeAt(sel.head).electricChars;if(electric)for(var i=0;i<electric.length;i++)
+if(inserted.indexOf(electric.charAt(i))>-1){indentLine(cm,sel.head.line,"smart");break;}}
+if(text.length>1000||text.indexOf("\n")>-1)input.value=cm.display.prevInput="";else cm.display.prevInput=text;if(withOp)endOperation(cm);cm.state.pasteIncoming=cm.state.cutIncoming=false;return true;}
function resetInput(cm,user){var minimal,selected,doc=cm.doc;if(!posEq(doc.sel.from,doc.sel.to)){cm.display.prevInput="";minimal=hasCopyEvent&&(doc.sel.to.line-doc.sel.from.line>100||(selected=cm.getSelection()).length>1000);var content=minimal?"-":selected||cm.getSelection();cm.display.input.value=content;if(cm.state.focused)selectInput(cm.display.input);if(ie&&!ie_lt9)cm.display.inputHasSelection=content;}else if(user){cm.display.prevInput=cm.display.input.value="";if(ie&&!ie_lt9)cm.display.inputHasSelection=null;}
cm.display.inaccurateSelection=minimal;}
function focusInput(cm){if(cm.options.readOnly!="nocursor"&&(!mobile||document.activeElement!=cm.display.input))
cm.display.input.focus();}
function isReadOnly(cm){return cm.options.readOnly||cm.doc.cantEdit;}
-function registerEventHandlers(cm){var d=cm.display;on(d.scroller,"mousedown",operation(cm,onMouseDown));if(ie)
+function registerEventHandlers(cm){var d=cm.display;on(d.scroller,"mousedown",operation(cm,onMouseDown));if(old_ie)
on(d.scroller,"dblclick",operation(cm,function(e){if(signalDOMEvent(cm,e))return;var pos=posFromMouse(cm,e);if(!pos||clickInGutter(cm,e)||eventInWidget(cm.display,e))return;e_preventDefault(e);var word=findWordAt(getLine(cm.doc,pos.line).text,pos);extendSelection(cm.doc,word.from,word.to);}));else
on(d.scroller,"dblclick",function(e){signalDOMEvent(cm,e)||e_preventDefault(e);});on(d.lineSpace,"selectstart",function(e){if(!eventInWidget(d,e))e_preventDefault(e);});if(!captureMiddleClick)on(d.scroller,"contextmenu",function(e){onContextMenu(cm,e);});on(d.scroller,"scroll",function(){if(d.scroller.clientHeight){setScrollTop(cm,d.scroller.scrollTop);setScrollLeft(cm,d.scroller.scrollLeft,true);signal(cm,"scroll",cm);}});on(d.scrollbarV,"scroll",function(){if(d.scroller.clientHeight)setScrollTop(cm,d.scrollbarV.scrollTop);});on(d.scrollbarH,"scroll",function(){if(d.scroller.clientHeight)setScrollLeft(cm,d.scrollbarH.scrollLeft);});on(d.scroller,"mousewheel",function(e){onScrollWheel(cm,e);});on(d.scroller,"DOMMouseScroll",function(e){onScrollWheel(cm,e);});function reFocus(){if(cm.state.focused)setTimeout(bind(focusInput,cm),0);}
on(d.scrollbarH,"mousedown",reFocus);on(d.scrollbarV,"mousedown",reFocus);on(d.wrapper,"scroll",function(){d.wrapper.scrollTop=d.wrapper.scrollLeft=0;});var resizeTimer;function onResize(){if(resizeTimer==null)resizeTimer=setTimeout(function(){resizeTimer=null;d.cachedCharWidth=d.cachedTextHeight=knownScrollbarWidth=null;clearCaches(cm);runInOp(cm,bind(regChange,cm));},100);}
on(window,"resize",onResize);function unregister(){for(var p=d.wrapper.parentNode;p&&p!=document.body;p=p.parentNode){}
if(p)setTimeout(unregister,5000);else off(window,"resize",onResize);}
-setTimeout(unregister,5000);on(d.input,"keyup",operation(cm,function(e){if(signalDOMEvent(cm,e)||cm.options.onKeyEvent&&cm.options.onKeyEvent(cm,addStop(e)))return;if(e.keyCode==16)cm.doc.sel.shift=false;}));on(d.input,"input",function(){if(ie&&!ie_lt9&&cm.display.inputHasSelection)cm.display.inputHasSelection=null;fastPoll(cm);});on(d.input,"keydown",operation(cm,onKeyDown));on(d.input,"keypress",operation(cm,onKeyPress));on(d.input,"focus",bind(onFocus,cm));on(d.input,"blur",bind(onBlur,cm));function drag_(e){if(signalDOMEvent(cm,e)||cm.options.onDragEvent&&cm.options.onDragEvent(cm,addStop(e)))return;e_stop(e);}
+setTimeout(unregister,5000);on(d.input,"keyup",operation(cm,onKeyUp));on(d.input,"input",function(){if(ie&&!ie_lt9&&cm.display.inputHasSelection)cm.display.inputHasSelection=null;fastPoll(cm);});on(d.input,"keydown",operation(cm,onKeyDown));on(d.input,"keypress",operation(cm,onKeyPress));on(d.input,"focus",bind(onFocus,cm));on(d.input,"blur",bind(onBlur,cm));function drag_(e){if(signalDOMEvent(cm,e)||cm.options.onDragEvent&&cm.options.onDragEvent(cm,addStop(e)))return;e_stop(e);}
if(cm.options.dragDrop){on(d.scroller,"dragstart",function(e){onDragStart(cm,e);});on(d.scroller,"dragenter",drag_);on(d.scroller,"dragover",drag_);on(d.scroller,"drop",operation(cm,onDrop));}
on(d.scroller,"paste",function(e){if(eventInWidget(d,e))return;focusInput(cm);fastPoll(cm);});on(d.input,"paste",function(){if(webkit&&!cm.state.fakedLastChar&&!(new Date-cm.state.lastMiddleDown<200)){var start=d.input.selectionStart,end=d.input.selectionEnd;d.input.value+="$";d.input.selectionStart=start;d.input.selectionEnd=end;cm.state.fakedLastChar=true;}
-cm.state.pasteIncoming=true;fastPoll(cm);});function prepareCopy(){if(d.inaccurateSelection){d.prevInput="";d.inaccurateSelection=false;d.input.value=cm.getSelection();selectInput(d.input);}}
+cm.state.pasteIncoming=true;fastPoll(cm);});function prepareCopy(e){if(d.inaccurateSelection){d.prevInput="";d.inaccurateSelection=false;d.input.value=cm.getSelection();selectInput(d.input);}
+if(e.type=="cut")cm.state.cutIncoming=true;}
on(d.input,"cut",prepareCopy);on(d.input,"copy",prepareCopy);if(khtml)on(d.sizer,"mouseup",function(){if(document.activeElement==d.input)d.input.blur();focusInput(cm);});}
function eventInWidget(display,e){for(var n=e_target(e);n!=display.wrapper;n=n.parentNode){if(!n||n.ignoreEvents||n.parentNode==display.sizer&&n!=display.mover)return true;}}
function posFromMouse(cm,e,liberal){var display=cm.display;if(!liberal){var target=e_target(e);if(target==display.scrollbarH||target==display.scrollbarH.firstChild||target==display.scrollbarV||target==display.scrollbarV.firstChild||target==display.scrollbarFiller||target==display.gutterFiller)return null;}
@@ -243,13 +247,14 @@
if(clickInGutter(cm,e))return;var start=posFromMouse(cm,e);switch(e_button(e)){case 3:if(captureMiddleClick)onContextMenu.call(cm,cm,e);return;case 2:if(webkit)cm.state.lastMiddleDown=+new Date;if(start)extendSelection(cm.doc,start);setTimeout(bind(focusInput,cm),20);e_preventDefault(e);return;}
if(!start){if(e_target(e)==display.scroller)e_preventDefault(e);return;}
if(!cm.state.focused)onFocus(cm);var now=+new Date,type="single";if(lastDoubleClick&&lastDoubleClick.time>now-400&&posEq(lastDoubleClick.pos,start)){type="triple";e_preventDefault(e);setTimeout(bind(focusInput,cm),20);selectLine(cm,start.line);}else if(lastClick&&lastClick.time>now-400&&posEq(lastClick.pos,start)){type="double";lastDoubleClick={time:now,pos:start};e_preventDefault(e);var word=findWordAt(getLine(doc,start.line).text,start);extendSelection(cm.doc,word.from,word.to);}else{lastClick={time:now,pos:start};}
-var last=start;if(cm.options.dragDrop&&dragAndDrop&&!isReadOnly(cm)&&!posEq(sel.from,sel.to)&&!posLess(start,sel.from)&&!posLess(sel.to,start)&&type=="single"){var dragEnd=operation(cm,function(e2){if(webkit)display.scroller.draggable=false;cm.state.draggingText=false;off(document,"mouseup",dragEnd);off(display.scroller,"drop",dragEnd);if(Math.abs(e.clientX-e2.clientX)+Math.abs(e.clientY-e2.clientY)<10){e_preventDefault(e2);extendSelection(cm.doc,start);focusInput(cm);}});if(webkit)display.scroller.draggable=true;cm.state.draggingText=dragEnd;if(display.scroller.dragDrop)display.scroller.dragDrop();on(document,"mouseup",dragEnd);on(display.scroller,"drop",dragEnd);return;}
+var last=start;if(cm.options.dragDrop&&dragAndDrop&&!isReadOnly(cm)&&!posEq(sel.from,sel.to)&&!posLess(start,sel.from)&&!posLess(sel.to,start)&&type=="single"){var dragEnd=operation(cm,function(e2){if(webkit)display.scroller.draggable=false;cm.state.draggingText=false;off(document,"mouseup",dragEnd);off(display.scroller,"drop",dragEnd);if(Math.abs(e.clientX-e2.clientX)+Math.abs(e.clientY-e2.clientY)<10){e_preventDefault(e2);extendSelection(cm.doc,start);focusInput(cm);if(old_ie&&!ie_lt9)
+setTimeout(function(){document.body.focus();focusInput(cm);},20);}});if(webkit)display.scroller.draggable=true;cm.state.draggingText=dragEnd;if(display.scroller.dragDrop)display.scroller.dragDrop();on(document,"mouseup",dragEnd);on(display.scroller,"drop",dragEnd);return;}
e_preventDefault(e);if(type=="single")extendSelection(cm.doc,clipPos(doc,start));var startstart=sel.from,startend=sel.to,lastPos=start;function doSelect(cur){if(posEq(lastPos,cur))return;lastPos=cur;if(type=="single"){extendSelection(cm.doc,clipPos(doc,start),cur);return;}
startstart=clipPos(doc,startstart);startend=clipPos(doc,startend);if(type=="double"){var word=findWordAt(getLine(doc,cur.line).text,cur);if(posLess(cur,startstart))extendSelection(cm.doc,word.from,startend);else extendSelection(cm.doc,startstart,word.to);}else if(type=="triple"){if(posLess(cur,startstart))extendSelection(cm.doc,startend,clipPos(doc,Pos(cur.line,0)));else extendSelection(cm.doc,startstart,clipPos(doc,Pos(cur.line+1,0)));}}
var editorSize=getRect(display.wrapper);var counter=0;function extend(e){var curCount=++counter;var cur=posFromMouse(cm,e,true);if(!cur)return;if(!posEq(cur,last)){if(!cm.state.focused)onFocus(cm);last=cur;doSelect(cur);var visible=visibleLines(display,doc);if(cur.line>=visible.to||cur.line<visible.from)
setTimeout(operation(cm,function(){if(counter==curCount)extend(e);}),150);}else{var outside=e.clientY<editorSize.top?-20:e.clientY>editorSize.bottom?20:0;if(outside)setTimeout(operation(cm,function(){if(counter!=curCount)return;display.scroller.scrollTop+=outside;extend(e);}),50);}}
function done(e){counter=Infinity;e_preventDefault(e);focusInput(cm);off(document,"mousemove",move);off(document,"mouseup",up);}
-var move=operation(cm,function(e){if(!ie&&!e_button(e))done(e);else extend(e);});var up=operation(cm,done);on(document,"mousemove",move);on(document,"mouseup",up);}
+var move=operation(cm,function(e){if(!old_ie&&!e_button(e))done(e);else extend(e);});var up=operation(cm,done);on(document,"mousemove",move);on(document,"mouseup",up);}
function gutterEvent(cm,e,type,prevent,signalfn){try{var mX=e.clientX,mY=e.clientY;}
catch(e){return false;}
if(mX>=Math.floor(getRect(cm.display.gutters).right))return false;if(prevent)e_preventDefault(e);var display=cm.display;var lineBox=getRect(display.lineDiv);if(mY>lineBox.bottom||!hasHandler(cm,type))return e_defaultPrevented(e);mY-=lineBox.top-display.viewOffset;for(var i=0;i<cm.options.gutters.length;++i){var g=display.gutters.childNodes[i];if(g&&getRect(g).right>=mX){var line=lineAtHeight(cm.doc,mY);var gutter=cm.options.gutters[i];signalfn(cm,type,cm,line,gutter,e);return e_defaultPrevented(e);}}}
@@ -264,7 +269,7 @@
e.dataTransfer.setDragImage(img,0,0);if(opera)img.parentNode.removeChild(img);}}
function setScrollTop(cm,val){if(Math.abs(cm.doc.scrollTop-val)<2)return;cm.doc.scrollTop=val;if(!gecko)updateDisplay(cm,[],val);if(cm.display.scroller.scrollTop!=val)cm.display.scroller.scrollTop=val;if(cm.display.scrollbarV.scrollTop!=val)cm.display.scrollbarV.scrollTop=val;if(gecko)updateDisplay(cm,[]);startWorker(cm,100);}
function setScrollLeft(cm,val,isScroller){if(isScroller?val==cm.doc.scrollLeft:Math.abs(cm.doc.scrollLeft-val)<2)return;val=Math.min(val,cm.display.scroller.scrollWidth-cm.display.scroller.clientWidth);cm.doc.scrollLeft=val;alignHorizontally(cm);if(cm.display.scroller.scrollLeft!=val)cm.display.scroller.scrollLeft=val;if(cm.display.scrollbarH.scrollLeft!=val)cm.display.scrollbarH.scrollLeft=val;}
-var wheelSamples=0,wheelPixelsPerUnit=null;if(ie)wheelPixelsPerUnit=-.53;else if(gecko)wheelPixelsPerUnit=15;else if(chrome)wheelPixelsPerUnit=-.7;else if(safari)wheelPixelsPerUnit=-1/3;function onScrollWheel(cm,e){var dx=e.wheelDeltaX,dy=e.wheelDeltaY;if(dx==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS)dx=e.detail;if(dy==null&&e.detail&&e.axis==e.VERTICAL_AXIS)dy=e.detail;else if(dy==null)dy=e.wheelDelta;var display=cm.display,scroll=display.scroller;if(!(dx&&scroll.scrollWidth>scroll.clientWidth||dy&&scroll.scrollHeight>scroll.clientHeight))return;if(dy&&mac&&webkit){for(var cur=e.target;cur!=scroll;cur=cur.parentNode){if(cur.lineObj){cm.display.currentWheelTarget=cur;break;}}}
+var wheelSamples=0,wheelPixelsPerUnit=null;if(old_ie)wheelPixelsPerUnit=-.53;else if(gecko)wheelPixelsPerUnit=15;else if(chrome)wheelPixelsPerUnit=-.7;else if(safari)wheelPixelsPerUnit=-1/3;function onScrollWheel(cm,e){var dx=e.wheelDeltaX,dy=e.wheelDeltaY;if(dx==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS)dx=e.detail;if(dy==null&&e.detail&&e.axis==e.VERTICAL_AXIS)dy=e.detail;else if(dy==null)dy=e.wheelDelta;var display=cm.display,scroll=display.scroller;if(!(dx&&scroll.scrollWidth>scroll.clientWidth||dy&&scroll.scrollHeight>scroll.clientHeight))return;if(dy&&mac&&webkit){for(var cur=e.target;cur!=scroll;cur=cur.parentNode){if(cur.lineObj){cm.display.currentWheelTarget=cur;break;}}}
if(dx&&!gecko&&!opera&&wheelPixelsPerUnit!=null){if(dy)
setScrollTop(cm,Math.max(0,Math.min(scroll.scrollTop+dy*wheelPixelsPerUnit,scroll.scrollHeight-scroll.clientHeight)));setScrollLeft(cm,Math.max(0,Math.min(scroll.scrollLeft+dx*wheelPixelsPerUnit,scroll.scrollWidth-scroll.clientWidth)));e_preventDefault(e);display.wheelStartX=null;return;}
if(dy&&wheelPixelsPerUnit!=null){var pixels=dy*wheelPixelsPerUnit;var top=cm.doc.scrollTop,bot=top+display.wrapper.clientHeight;if(pixels<0)top=Math.max(0,top+pixels-50);else bot=Math.min(cm.doc.height,bot+pixels+50);updateDisplay(cm,[],{top:top,bottom:bot});}
@@ -280,21 +285,21 @@
return handled;}
function handleCharBinding(cm,e,ch){var handled=lookupKey("'"+ch+"'",allKeyMaps(cm),function(b){return doHandleBinding(cm,b,true);});if(handled){e_preventDefault(e);restartBlink(cm);signalLater(cm,"keyHandled",cm,"'"+ch+"'",e);}
return handled;}
-var lastStoppedKey=null;function onKeyDown(e){var cm=this;if(!cm.state.focused)onFocus(cm);if(signalDOMEvent(cm,e)||cm.options.onKeyEvent&&cm.options.onKeyEvent(cm,addStop(e)))return;if(ie&&e.keyCode==27)e.returnValue=false;var code=e.keyCode;cm.doc.sel.shift=code==16||e.shiftKey;var handled=handleKeyBinding(cm,e);if(opera){lastStoppedKey=handled?code:null;if(!handled&&code==88&&!hasCopyEvent&&(mac?e.metaKey:e.ctrlKey))
+function onKeyUp(e){var cm=this;if(signalDOMEvent(cm,e)||cm.options.onKeyEvent&&cm.options.onKeyEvent(cm,addStop(e)))return;if(e.keyCode==16)cm.doc.sel.shift=false;}
+var lastStoppedKey=null;function onKeyDown(e){var cm=this;if(!cm.state.focused)onFocus(cm);if(signalDOMEvent(cm,e)||cm.options.onKeyEvent&&cm.options.onKeyEvent(cm,addStop(e)))return;if(old_ie&&e.keyCode==27)e.returnValue=false;var code=e.keyCode;cm.doc.sel.shift=code==16||e.shiftKey;var handled=handleKeyBinding(cm,e);if(opera){lastStoppedKey=handled?code:null;if(!handled&&code==88&&!hasCopyEvent&&(mac?e.metaKey:e.ctrlKey))
cm.replaceSelection("");}}
function onKeyPress(e){var cm=this;if(signalDOMEvent(cm,e)||cm.options.onKeyEvent&&cm.options.onKeyEvent(cm,addStop(e)))return;var keyCode=e.keyCode,charCode=e.charCode;if(opera&&keyCode==lastStoppedKey){lastStoppedKey=null;e_preventDefault(e);return;}
-if(((opera&&(!e.which||e.which<10))||khtml)&&handleKeyBinding(cm,e))return;var ch=String.fromCharCode(charCode==null?keyCode:charCode);if(this.options.electricChars&&this.doc.mode.electricChars&&this.options.smartIndent&&!isReadOnly(this)&&this.doc.mode.electricChars.indexOf(ch)>-1)
-setTimeout(operation(cm,function(){indentLine(cm,cm.doc.sel.to.line,"smart");}),75);if(handleCharBinding(cm,e,ch))return;if(ie&&!ie_lt9)cm.display.inputHasSelection=null;fastPoll(cm);}
+if(((opera&&(!e.which||e.which<10))||khtml)&&handleKeyBinding(cm,e))return;var ch=String.fromCharCode(charCode==null?keyCode:charCode);if(handleCharBinding(cm,e,ch))return;if(ie&&!ie_lt9)cm.display.inputHasSelection=null;fastPoll(cm);}
function onFocus(cm){if(cm.options.readOnly=="nocursor")return;if(!cm.state.focused){signal(cm,"focus",cm);cm.state.focused=true;if(cm.display.wrapper.className.search(/\bCodeMirror-focused\b/)==-1)
cm.display.wrapper.className+=" CodeMirror-focused";if(!cm.curOp){resetInput(cm,true);if(webkit)setTimeout(bind(resetInput,cm,true),0);}}
slowPoll(cm);restartBlink(cm);}
function onBlur(cm){if(cm.state.focused){signal(cm,"blur",cm);cm.state.focused=false;cm.display.wrapper.className=cm.display.wrapper.className.replace(" CodeMirror-focused","");}
clearInterval(cm.display.blinker);setTimeout(function(){if(!cm.state.focused)cm.doc.sel.shift=false;},150);}
var detectingSelectAll;function onContextMenu(cm,e){if(signalDOMEvent(cm,e,"contextmenu"))return;var display=cm.display,sel=cm.doc.sel;if(eventInWidget(display,e)||contextMenuInGutter(cm,e))return;var pos=posFromMouse(cm,e),scrollPos=display.scroller.scrollTop;if(!pos||opera)return;var reset=cm.options.resetSelectionOnContextMenu;if(reset&&(posEq(sel.from,sel.to)||posLess(pos,sel.from)||!posLess(pos,sel.to)))
-operation(cm,setSelection)(cm.doc,pos,pos);var oldCSS=display.input.style.cssText;display.inputDiv.style.position="absolute";display.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: white; outline: none;"+"border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);";focusInput(cm);resetInput(cm,true);if(posEq(sel.from,sel.to))display.input.value=display.prevInput=" ";function prepareSelectAllHack(){if(display.input.selectionStart!=null){var extval=display.input.value="\u200b"+(posEq(sel.from,sel.to)?"":display.input.value);display.prevInput="\u200b";display.input.selectionStart=1;display.input.selectionEnd=extval.length;}}
-function rehide(){display.inputDiv.style.position="relative";display.input.style.cssText=oldCSS;if(ie_lt9)display.scrollbarV.scrollTop=display.scroller.scrollTop=scrollPos;slowPoll(cm);if(display.input.selectionStart!=null){if(!ie||ie_lt9)prepareSelectAllHack();clearTimeout(detectingSelectAll);var i=0,poll=function(){if(display.prevInput==" "&&display.input.selectionStart==0)
+operation(cm,setSelection)(cm.doc,pos,pos);var oldCSS=display.input.style.cssText;display.inputDiv.style.position="absolute";display.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: transparent; outline: none;"+"border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);";focusInput(cm);resetInput(cm,true);if(posEq(sel.from,sel.to))display.input.value=display.prevInput=" ";function prepareSelectAllHack(){if(display.input.selectionStart!=null){var extval=display.input.value="\u200b"+(posEq(sel.from,sel.to)?"":display.input.value);display.prevInput="\u200b";display.input.selectionStart=1;display.input.selectionEnd=extval.length;}}
+function rehide(){display.inputDiv.style.position="relative";display.input.style.cssText=oldCSS;if(ie_lt9)display.scrollbarV.scrollTop=display.scroller.scrollTop=scrollPos;slowPoll(cm);if(display.input.selectionStart!=null){if(!old_ie||ie_lt9)prepareSelectAllHack();clearTimeout(detectingSelectAll);var i=0,poll=function(){if(display.prevInput=="\u200b"&&display.input.selectionStart==0)
operation(cm,commands.selectAll)(cm);else if(i++<10)detectingSelectAll=setTimeout(poll,500);else resetInput(cm);};detectingSelectAll=setTimeout(poll,200);}}
-if(ie&&!ie_lt9)prepareSelectAllHack();if(captureMiddleClick){e_stop(e);var mouseup=function(){off(window,"mouseup",mouseup);setTimeout(rehide,20);};on(window,"mouseup",mouseup);}else{setTimeout(rehide,50);}}
+if(old_ie&&!ie_lt9)prepareSelectAllHack();if(captureMiddleClick){e_stop(e);var mouseup=function(){off(window,"mouseup",mouseup);setTimeout(rehide,20);};on(window,"mouseup",mouseup);}else{setTimeout(rehide,50);}}
var changeEnd=CodeMirror.changeEnd=function(change){if(!change.text)return change.to;return Pos(change.from.line+change.text.length-1,lst(change.text).length+(change.text.length==1?change.from.ch:0));};function clipPostChange(doc,change,pos){if(!posLess(change.from,pos))return clipPos(doc,pos);var diff=(change.text.length-1)-(change.to.line-change.from.line);if(pos.line>change.to.line+diff){var preLine=pos.line-diff,lastLine=doc.first+doc.size-1;if(preLine>lastLine)return Pos(lastLine,getLine(doc,lastLine).text.length);return clipToLen(pos,getLine(doc,preLine).text.length);}
if(pos.line==change.to.line+diff)
return clipToLen(pos,lst(change.text).length+(change.text.length==1?change.from.ch:0)+
@@ -329,6 +334,7 @@
function Pos(line,ch){if(!(this instanceof Pos))return new Pos(line,ch);this.line=line;this.ch=ch;}
CodeMirror.Pos=Pos;function posEq(a,b){return a.line==b.line&&a.ch==b.ch;}
function posLess(a,b){return a.line<b.line||(a.line==b.line&&a.ch<b.ch);}
+function cmp(a,b){return a.line-b.line||a.ch-b.ch;}
function copyPos(x){return Pos(x.line,x.ch);}
function clipLine(doc,n){return Math.max(doc.first,Math.min(n,doc.first+doc.size-1));}
function clipPos(doc,pos){if(pos.line<doc.first)return Pos(doc.first,0);var last=doc.first+doc.size-1;if(pos.line>last)return Pos(last,getLine(doc,last).text.length);return clipToLen(pos,getLine(doc,pos.line).text.length);}
@@ -350,8 +356,10 @@
flipped=true;newPos=pos;dir=-dir;}}
curPos=newPos;continue search;}}}
return curPos;}}
-function scrollCursorIntoView(cm){var coords=scrollPosIntoView(cm,cm.doc.sel.head,null,cm.options.cursorScrollMargin);if(!cm.state.focused)return;var display=cm.display,box=getRect(display.sizer),doScroll=null;if(coords.top+box.top<0)doScroll=true;else if(coords.bottom+box.top>(window.innerHeight||document.documentElement.clientHeight))doScroll=false;if(doScroll!=null&&!phantom){var hidden=display.cursor.style.display=="none";if(hidden){display.cursor.style.display="";display.cursor.style.left=coords.left+"px";display.cursor.style.top=(coords.top-display.viewOffset)+"px";}
-display.cursor.scrollIntoView(doScroll);if(hidden)display.cursor.style.display="none";}}
+function scrollCursorIntoView(cm){var coords=scrollPosIntoView(cm,cm.doc.sel.head,null,cm.options.cursorScrollMargin);if(!cm.state.focused)return;var display=cm.display,box=getRect(display.sizer),doScroll=null;if(coords.top+box.top<0)doScroll=true;else if(coords.bottom+box.top>(window.innerHeight||document.documentElement.clientHeight))doScroll=false;if(doScroll!=null&&!phantom){var scrollNode=elt("div","\u200b",null,"position: absolute; top: "+
+(coords.top-display.viewOffset)+"px; height: "+
+(coords.bottom-coords.top+scrollerCutOff)+"px; left: "+
+coords.left+"px; width: 2px;");cm.display.lineSpace.appendChild(scrollNode);scrollNode.scrollIntoView(doScroll);cm.display.lineSpace.removeChild(scrollNode);}}
function scrollPosIntoView(cm,pos,end,margin){if(margin==null)margin=0;for(;;){var changed=false,coords=cursorCoords(cm,pos);var endCoords=!end||end==pos?coords:cursorCoords(cm,end);var scrollPos=calculateScrollPos(cm,Math.min(coords.left,endCoords.left),Math.min(coords.top,endCoords.top)-margin,Math.max(coords.left,endCoords.left),Math.max(coords.bottom,endCoords.bottom)+margin);var startTop=cm.doc.scrollTop,startLeft=cm.doc.scrollLeft;if(scrollPos.scrollTop!=null){setScrollTop(cm,scrollPos.scrollTop);if(Math.abs(cm.doc.scrollTop-startTop)>1)changed=true;}
if(scrollPos.scrollLeft!=null){setScrollLeft(cm,scrollPos.scrollLeft);if(Math.abs(cm.doc.scrollLeft-startLeft)>1)changed=true;}
if(!changed)return coords;}}
@@ -362,7 +370,7 @@
function updateScrollPos(cm,left,top){cm.curOp.updateScrollPos={scrollLeft:left==null?cm.doc.scrollLeft:left,scrollTop:top==null?cm.doc.scrollTop:top};}
function addToScrollPos(cm,left,top){var pos=cm.curOp.updateScrollPos||(cm.curOp.updateScrollPos={scrollLeft:cm.doc.scrollLeft,scrollTop:cm.doc.scrollTop});var scroll=cm.display.scroller;pos.scrollTop=Math.max(0,Math.min(scroll.scrollHeight-scroll.clientHeight,pos.scrollTop+top));pos.scrollLeft=Math.max(0,Math.min(scroll.scrollWidth-scroll.clientWidth,pos.scrollLeft+left));}
function indentLine(cm,n,how,aggressive){var doc=cm.doc;if(how==null)how="add";if(how=="smart"){if(!cm.doc.mode.indent)how="prev";else var state=getStateBefore(cm,n);}
-var tabSize=cm.options.tabSize;var line=getLine(doc,n),curSpace=countColumn(line.text,null,tabSize);var curSpaceString=line.text.match(/^\s*/)[0],indentation;if(how=="smart"){indentation=cm.doc.mode.indent(state,line.text.slice(curSpaceString.length),line.text);if(indentation==Pass){if(!aggressive)return;how="prev";}}
+var tabSize=cm.options.tabSize;var line=getLine(doc,n),curSpace=countColumn(line.text,null,tabSize);var curSpaceString=line.text.match(/^\s*/)[0],indentation;if(!aggressive&&!/\S/.test(line.text)){indentation=0;how="not";}else if(how=="smart"){indentation=cm.doc.mode.indent(state,line.text.slice(curSpaceString.length),line.text);if(indentation==Pass){if(!aggressive)return;how="prev";}}
if(how=="prev"){if(n>doc.first)indentation=countColumn(getLine(doc,n-1).text,null,tabSize);else indentation=0;}else if(how=="add"){indentation=curSpace+cm.options.indentUnit;}else if(how=="subtract"){indentation=curSpace-cm.options.indentUnit;}else if(typeof how=="number"){indentation=curSpace+how;}
indentation=Math.max(0,indentation);var indentString="",pos=0;if(cm.options.indentWithTabs)
for(var i=Math.floor(indentation/tabSize);i;--i){pos+=tabSize;indentString+="\t";}
@@ -386,8 +394,11 @@
CodeMirror.prototype={constructor:CodeMirror,focus:function(){window.focus();focusInput(this);fastPoll(this);},setOption:function(option,value){var options=this.options,old=options[option];if(options[option]==value&&option!="mode")return;options[option]=value;if(optionHandlers.hasOwnProperty(option))
operation(this,optionHandlers[option])(this,value,old);},getOption:function(option){return this.options[option];},getDoc:function(){return this.doc;},addKeyMap:function(map,bottom){this.state.keyMaps[bottom?"push":"unshift"](map);},removeKeyMap:function(map){var maps=this.state.keyMaps;for(var i=0;i<maps.length;++i)
if(maps[i]==map||(typeof maps[i]!="string"&&maps[i].name==map)){maps.splice(i,1);return true;}},addOverlay:operation(null,function(spec,options){var mode=spec.token?spec:CodeMirror.getMode(this.options,spec);if(mode.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:mode,modeSpec:spec,opaque:options&&options.opaque});this.state.modeGen++;regChange(this);}),removeOverlay:operation(null,function(spec){var overlays=this.state.overlays;for(var i=0;i<overlays.length;++i){var cur=overlays[i].modeSpec;if(cur==spec||typeof spec=="string"&&cur.name==spec){overlays.splice(i,1);this.state.modeGen++;regChange(this);return;}}}),indentLine:operation(null,function(n,dir,aggressive){if(typeof dir!="string"&&typeof dir!="number"){if(dir==null)dir=this.options.smartIndent?"smart":"prev";else dir=dir?"add":"subtract";}
-if(isLine(this.doc,n))indentLine(this,n,dir,aggressive);}),indentSelection:operation(null,function(how){var sel=this.doc.sel;if(posEq(sel.from,sel.to))return indentLine(this,sel.from.line,how);var e=sel.to.line-(sel.to.ch?0:1);for(var i=sel.from.line;i<=e;++i)indentLine(this,i,how);}),getTokenAt:function(pos,precise){var doc=this.doc;pos=clipPos(doc,pos);var state=getStateBefore(this,pos.line,precise),mode=this.doc.mode;var line=getLine(doc,pos.line);var stream=new StringStream(line.text,this.options.tabSize);while(stream.pos<pos.ch&&!stream.eol()){stream.start=stream.pos;var style=mode.token(stream,state);}
-return{start:stream.start,end:stream.pos,string:stream.current(),className:style||null,type:style||null,state:state};},getTokenTypeAt:function(pos){pos=clipPos(this.doc,pos);var styles=getLineStyles(this,getLine(this.doc,pos.line));var before=0,after=(styles.length-1)/2,ch=pos.ch;if(ch==0)return styles[2];for(;;){var mid=(before+after)>>1;if((mid?styles[mid*2-1]:0)>=ch)after=mid;else if(styles[mid*2+1]<ch)before=mid+1;else return styles[mid*2+2];}},getModeAt:function(pos){var mode=this.doc.mode;if(!mode.innerMode)return mode;return CodeMirror.innerMode(mode,this.getTokenAt(pos).state).mode;},getHelper:function(pos,type){if(!helpers.hasOwnProperty(type))return;var help=helpers[type],mode=this.getModeAt(pos);return mode[type]&&help[mode[type]]||mode.helperType&&help[mode.helperType]||help[mode.name];},getStateAfter:function(line,precise){var doc=this.doc;line=clipLine(doc,line==null?doc.first+doc.size-1:line);return getStateBefore(this,line+1,precise);},cursorCoords:function(start,mode){var pos,sel=this.doc.sel;if(start==null)pos=sel.head;else if(typeof start=="object")pos=clipPos(this.doc,start);else pos=start?sel.from:sel.to;return cursorCoords(this,pos,mode||"page");},charCoords:function(pos,mode){return charCoords(this,clipPos(this.doc,pos),mode||"page");},coordsChar:function(coords,mode){coords=fromCoordSystem(this,coords,mode||"page");return coordsChar(this,coords.left,coords.top);},lineAtHeight:function(height,mode){height=fromCoordSystem(this,{top:height,left:0},mode||"page").top;return lineAtHeight(this.doc,height+this.display.viewOffset);},heightAtLine:function(line,mode){var end=false,last=this.doc.first+this.doc.size-1;if(line<this.doc.first)line=this.doc.first;else if(line>last){line=last;end=true;}
+if(isLine(this.doc,n))indentLine(this,n,dir,aggressive);}),indentSelection:operation(null,function(how){var sel=this.doc.sel;if(posEq(sel.from,sel.to))return indentLine(this,sel.from.line,how,true);var e=sel.to.line-(sel.to.ch?0:1);for(var i=sel.from.line;i<=e;++i)indentLine(this,i,how);}),getTokenAt:function(pos,precise){var doc=this.doc;pos=clipPos(doc,pos);var state=getStateBefore(this,pos.line,precise),mode=this.doc.mode;var line=getLine(doc,pos.line);var stream=new StringStream(line.text,this.options.tabSize);while(stream.pos<pos.ch&&!stream.eol()){stream.start=stream.pos;var style=mode.token(stream,state);}
+return{start:stream.start,end:stream.pos,string:stream.current(),className:style||null,type:style||null,state:state};},getTokenTypeAt:function(pos){pos=clipPos(this.doc,pos);var styles=getLineStyles(this,getLine(this.doc,pos.line));var before=0,after=(styles.length-1)/2,ch=pos.ch;if(ch==0)return styles[2];for(;;){var mid=(before+after)>>1;if((mid?styles[mid*2-1]:0)>=ch)after=mid;else if(styles[mid*2+1]<ch)before=mid+1;else return styles[mid*2+2];}},getModeAt:function(pos){var mode=this.doc.mode;if(!mode.innerMode)return mode;return CodeMirror.innerMode(mode,this.getTokenAt(pos).state).mode;},getHelper:function(pos,type){return this.getHelpers(pos,type)[0];},getHelpers:function(pos,type){var found=[];if(!helpers.hasOwnProperty(type))return helpers;var help=helpers[type],mode=this.getModeAt(pos);if(typeof mode[type]=="string"){if(help[mode[type]])found.push(help[mode[type]]);}else if(mode[type]){for(var i=0;i<mode[type].length;i++){var val=help[mode[type][i]];if(val)found.push(val);}}else if(mode.helperType&&help[mode.helperType]){found.push(help[mode.helperType]);}else if(help[mode.name]){found.push(help[mode.name]);}
+for(var i=0;i<help._global.length;i++){var cur=help._global[i];if(cur.pred(mode,this)&&indexOf(found,cur.val)==-1)
+found.push(cur.val);}
+return found;},getStateAfter:function(line,precise){var doc=this.doc;line=clipLine(doc,line==null?doc.first+doc.size-1:line);return getStateBefore(this,line+1,precise);},cursorCoords:function(start,mode){var pos,sel=this.doc.sel;if(start==null)pos=sel.head;else if(typeof start=="object")pos=clipPos(this.doc,start);else pos=start?sel.from:sel.to;return cursorCoords(this,pos,mode||"page");},charCoords:function(pos,mode){return charCoords(this,clipPos(this.doc,pos),mode||"page");},coordsChar:function(coords,mode){coords=fromCoordSystem(this,coords,mode||"page");return coordsChar(this,coords.left,coords.top);},lineAtHeight:function(height,mode){height=fromCoordSystem(this,{top:height,left:0},mode||"page").top;return lineAtHeight(this.doc,height+this.display.viewOffset);},heightAtLine:function(line,mode){var end=false,last=this.doc.first+this.doc.size-1;if(line<this.doc.first)line=this.doc.first;else if(line>last){line=last;end=true;}
var lineObj=getLine(this.doc,line);return intoCoordSystem(this,getLine(this.doc,line),{top:0,left:0},mode||"page").top+
(end?lineObj.height:0);},defaultTextHeight:function(){return textHeight(this.display);},defaultCharWidth:function(){return charWidth(this.display);},setGutterMarker:operation(null,function(line,gutterID,value){return changeLine(this,line,function(line){var markers=line.gutterMarkers||(line.gutterMarkers={});markers[gutterID]=value;if(!value&&isEmpty(markers))line.gutterMarkers=null;return true;});}),clearGutter:operation(null,function(gutterID){var cm=this,doc=cm.doc,i=doc.first;doc.iter(function(line){if(line.gutterMarkers&&line.gutterMarkers[gutterID]){line.gutterMarkers[gutterID]=null;regChange(cm,i,i+1);if(isEmpty(line.gutterMarkers))line.gutterMarkers=null;}
++i;});}),addLineClass:operation(null,function(handle,where,cls){return changeLine(this,handle,function(line){var prop=where=="text"?"textClass":where=="background"?"bgClass":"wrapClass";if(!line[prop])line[prop]=cls;else if(new RegExp("(?:^|\\s)"+cls+"(?:$|\\s)").test(line[prop]))return false;else line[prop]+=" "+cls;return true;});}),removeLineClass:operation(null,function(handle,where,cls){return changeLine(this,handle,function(line){var prop=where=="text"?"textClass":where=="background"?"bgClass":"wrapClass";var cur=line[prop];if(!cur)return false;else if(cls==null)line[prop]=null;else{var found=cur.match(new RegExp("(?:^|\\s+)"+cls+"(?:$|\\s+)"));if(!found)return false;var end=found.index+found[0].length;line[prop]=cur.slice(0,found.index)+(!found.index||end==cur.length?"":" ")+cur.slice(end)||null;}
@@ -398,22 +409,26 @@
left=hspace-node.offsetWidth;}
node.style.top=top+"px";node.style.left=node.style.right="";if(horiz=="right"){left=display.sizer.clientWidth-node.offsetWidth;node.style.right="0px";}else{if(horiz=="left")left=0;else if(horiz=="middle")left=(display.sizer.clientWidth-node.offsetWidth)/2;node.style.left=left+"px";}
if(scroll)
-scrollIntoView(this,left,top,left+node.offsetWidth,top+node.offsetHeight);},triggerOnKeyDown:operation(null,onKeyDown),execCommand:function(cmd){return commands[cmd](this);},findPosH:function(from,amount,unit,visually){var dir=1;if(amount<0){dir=-1;amount=-amount;}
+scrollIntoView(this,left,top,left+node.offsetWidth,top+node.offsetHeight);},triggerOnKeyDown:operation(null,onKeyDown),triggerOnKeyPress:operation(null,onKeyPress),triggerOnKeyUp:operation(null,onKeyUp),execCommand:function(cmd){if(commands.hasOwnProperty(cmd))
+return commands[cmd](this);},findPosH:function(from,amount,unit,visually){var dir=1;if(amount<0){dir=-1;amount=-amount;}
for(var i=0,cur=clipPos(this.doc,from);i<amount;++i){cur=findPosH(this.doc,cur,dir,unit,visually);if(cur.hitSide)break;}
return cur;},moveH:operation(null,function(dir,unit){var sel=this.doc.sel,pos;if(sel.shift||sel.extend||posEq(sel.from,sel.to))
pos=findPosH(this.doc,sel.head,dir,unit,this.options.rtlMoveVisually);else
pos=dir<0?sel.from:sel.to;extendSelection(this.doc,pos,pos,dir);}),deleteH:operation(null,function(dir,unit){var sel=this.doc.sel;if(!posEq(sel.from,sel.to))replaceRange(this.doc,"",sel.from,sel.to,"+delete");else replaceRange(this.doc,"",sel.from,findPosH(this.doc,sel.head,dir,unit,false),"+delete");this.curOp.userSelChange=true;}),findPosV:function(from,amount,unit,goalColumn){var dir=1,x=goalColumn;if(amount<0){dir=-1;amount=-amount;}
for(var i=0,cur=clipPos(this.doc,from);i<amount;++i){var coords=cursorCoords(this,cur,"div");if(x==null)x=coords.left;else coords.left=x;cur=findPosV(this,coords,dir,unit);if(cur.hitSide)break;}
-return cur;},moveV:operation(null,function(dir,unit){var sel=this.doc.sel;var pos=cursorCoords(this,sel.head,"div");if(sel.goalColumn!=null)pos.left=sel.goalColumn;var target=findPosV(this,pos,dir,unit);if(unit=="page")addToScrollPos(this,0,charCoords(this,target,"div").top-pos.top);extendSelection(this.doc,target,target,dir);sel.goalColumn=pos.left;}),toggleOverwrite:function(value){if(value!=null&&value==this.state.overwrite)return;if(this.state.overwrite=!this.state.overwrite)
+return cur;},moveV:operation(null,function(dir,unit){var sel=this.doc.sel,target,goal;if(sel.shift||sel.extend||posEq(sel.from,sel.to)){var pos=cursorCoords(this,sel.head,"div");if(sel.goalColumn!=null)pos.left=sel.goalColumn;target=findPosV(this,pos,dir,unit);if(unit=="page")addToScrollPos(this,0,charCoords(this,target,"div").top-pos.top);goal=pos.left;}else{target=dir<0?sel.from:sel.to;}
+extendSelection(this.doc,target,target,dir);if(goal!=null)sel.goalColumn=goal;}),toggleOverwrite:function(value){if(value!=null&&value==this.state.overwrite)return;if(this.state.overwrite=!this.state.overwrite)
this.display.cursor.className+=" CodeMirror-overwrite";else
-this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite","");},hasFocus:function(){return this.state.focused;},scrollTo:operation(null,function(x,y){updateScrollPos(this,x,y);}),getScrollInfo:function(){var scroller=this.display.scroller,co=scrollerCutOff;return{left:scroller.scrollLeft,top:scroller.scrollTop,height:scroller.scrollHeight-co,width:scroller.scrollWidth-co,clientHeight:scroller.clientHeight-co,clientWidth:scroller.clientWidth-co};},scrollIntoView:operation(null,function(range,margin){if(range==null)range={from:this.doc.sel.head,to:null};else if(typeof range=="number")range={from:Pos(range,0),to:null};else if(range.from==null)range={from:range,to:null};if(!range.to)range.to=range.from;if(!margin)margin=0;var coords=range;if(range.from.line!=null){this.curOp.scrollToPos={from:range.from,to:range.to,margin:margin};coords={from:cursorCoords(this,range.from),to:cursorCoords(this,range.to)};}
+this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite","");},hasFocus:function(){return document.activeElement==this.display.input;},scrollTo:operation(null,function(x,y){updateScrollPos(this,x,y);}),getScrollInfo:function(){var scroller=this.display.scroller,co=scrollerCutOff;return{left:scroller.scrollLeft,top:scroller.scrollTop,height:scroller.scrollHeight-co,width:scroller.scrollWidth-co,clientHeight:scroller.clientHeight-co,clientWidth:scroller.clientWidth-co};},scrollIntoView:operation(null,function(range,margin){if(range==null)range={from:this.doc.sel.head,to:null};else if(typeof range=="number")range={from:Pos(range,0),to:null};else if(range.from==null)range={from:range,to:null};if(!range.to)range.to=range.from;if(!margin)margin=0;var coords=range;if(range.from.line!=null){this.curOp.scrollToPos={from:range.from,to:range.to,margin:margin};coords={from:cursorCoords(this,range.from),to:cursorCoords(this,range.to)};}
var sPos=calculateScrollPos(this,Math.min(coords.from.left,coords.to.left),Math.min(coords.from.top,coords.to.top)-margin,Math.max(coords.from.right,coords.to.right),Math.max(coords.from.bottom,coords.to.bottom)+margin);updateScrollPos(this,sPos.scrollLeft,sPos.scrollTop);}),setSize:operation(null,function(width,height){function interpret(val){return typeof val=="number"||/^\d+$/.test(String(val))?val+"px":val;}
if(width!=null)this.display.wrapper.style.width=interpret(width);if(height!=null)this.display.wrapper.style.height=interpret(height);if(this.options.lineWrapping)
-this.display.measureLineCache.length=this.display.measureLineCachePos=0;this.curOp.forceUpdate=true;}),operation:function(f){return runInOp(this,f);},refresh:operation(null,function(){var badHeight=this.display.cachedTextHeight==null;clearCaches(this);updateScrollPos(this,this.doc.scrollLeft,this.doc.scrollTop);regChange(this);if(badHeight)estimateLineHeights(this);}),swapDoc:operation(null,function(doc){var old=this.doc;old.cm=null;attachDoc(this,doc);clearCaches(this);resetInput(this,true);updateScrollPos(this,doc.scrollLeft,doc.scrollTop);signalLater(this,"swapDoc",this,old);return old;}),getInputField:function(){return this.display.input;},getWrapperElement:function(){return this.display.wrapper;},getScrollerElement:function(){return this.display.scroller;},getGutterElement:function(){return this.display.gutters;}};eventMixin(CodeMirror);var optionHandlers=CodeMirror.optionHandlers={};var defaults=CodeMirror.defaults={};function option(name,deflt,handle,notOnInit){CodeMirror.defaults[name]=deflt;if(handle)optionHandlers[name]=notOnInit?function(cm,val,old){if(old!=Init)handle(cm,val,old);}:handle;}
-var Init=CodeMirror.Init={toString:function(){return"CodeMirror.Init";}};option("value","",function(cm,val){cm.setValue(val);},true);option("mode",null,function(cm,val){cm.doc.modeOption=val;loadMode(cm);},true);option("indentUnit",2,loadMode,true);option("indentWithTabs",false);option("smartIndent",true);option("tabSize",4,function(cm){loadMode(cm);clearCaches(cm);regChange(cm);},true);option("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,function(cm,val){cm.options.specialChars=new RegExp(val.source+(val.test("\t")?"":"|\t"),"g");cm.refresh();},true);option("specialCharPlaceholder",defaultSpecialCharPlaceholder,function(cm){cm.refresh();},true);option("electricChars",true);option("rtlMoveVisually",!windows);option("wholeLineUpdateBefore",true);option("theme","default",function(cm){themeChanged(cm);guttersChanged(cm);},true);option("keyMap","default",keyMapChanged);option("extraKeys",null);option("onKeyEvent",null);option("onDragEvent",null);option("lineWrapping",false,wrappingChanged,true);option("gutters",[],function(cm){setGuttersForLineNumbers(cm.options);guttersChanged(cm);},true);option("fixedGutter",true,function(cm,val){cm.display.gutters.style.left=val?compensateForHScroll(cm.display)+"px":"0";cm.refresh();},true);option("coverGutterNextToScrollbar",false,updateScrollbars,true);option("lineNumbers",false,function(cm){setGuttersForLineNumbers(cm.options);guttersChanged(cm);},true);option("firstLineNumber",1,guttersChanged,true);option("lineNumberFormatter",function(integer){return integer;},guttersChanged,true);option("showCursorWhenSelecting",false,updateSelection,true);option("resetSelectionOnContextMenu",true);option("readOnly",false,function(cm,val){if(val=="nocursor"){onBlur(cm);cm.display.input.blur();cm.display.disabled=true;}else{cm.display.disabled=false;if(!val)resetInput(cm,true);}});option("dragDrop",true);option("cursorBlinkRate",530);option("cursorScrollMargin",0);option("cursorHeight",1);option("workTime",100);option("workDelay",100);option("flattenSpans",true);option("pollInterval",100);option("undoDepth",40,function(cm,val){cm.doc.history.undoDepth=val;});option("historyEventDelay",500);option("viewportMargin",10,function(cm){cm.refresh();},true);option("maxHighlightLength",10000,function(cm){loadMode(cm);cm.refresh();},true);option("crudeMeasuringFrom",10000);option("moveInputWithCursor",true,function(cm,val){if(!val)cm.display.inputDiv.style.top=cm.display.inputDiv.style.left=0;});option("tabindex",null,function(cm,val){cm.display.input.tabIndex=val||"";});option("autofocus",null);var modes=CodeMirror.modes={},mimeModes=CodeMirror.mimeModes={};CodeMirror.defineMode=function(name,mode){if(!CodeMirror.defaults.mode&&name!="null")CodeMirror.defaults.mode=name;if(arguments.length>2){mode.dependencies=[];for(var i=2;i<arguments.length;++i)mode.dependencies.push(arguments[i]);}
+this.display.measureLineCache.length=this.display.measureLineCachePos=0;this.curOp.forceUpdate=true;signal(this,"refresh",this);}),operation:function(f){return runInOp(this,f);},refresh:operation(null,function(){var oldHeight=this.display.cachedTextHeight;clearCaches(this);updateScrollPos(this,this.doc.scrollLeft,this.doc.scrollTop);regChange(this);if(oldHeight==null||Math.abs(oldHeight-textHeight(this.display))>.5)
+estimateLineHeights(this);signal(this,"refresh",this);}),swapDoc:operation(null,function(doc){var old=this.doc;old.cm=null;attachDoc(this,doc);clearCaches(this);resetInput(this,true);updateScrollPos(this,doc.scrollLeft,doc.scrollTop);signalLater(this,"swapDoc",this,old);return old;}),getInputField:function(){return this.display.input;},getWrapperElement:function(){return this.display.wrapper;},getScrollerElement:function(){return this.display.scroller;},getGutterElement:function(){return this.display.gutters;}};eventMixin(CodeMirror);var optionHandlers=CodeMirror.optionHandlers={};var defaults=CodeMirror.defaults={};function option(name,deflt,handle,notOnInit){CodeMirror.defaults[name]=deflt;if(handle)optionHandlers[name]=notOnInit?function(cm,val,old){if(old!=Init)handle(cm,val,old);}:handle;}
+var Init=CodeMirror.Init={toString:function(){return"CodeMirror.Init";}};option("value","",function(cm,val){cm.setValue(val);},true);option("mode",null,function(cm,val){cm.doc.modeOption=val;loadMode(cm);},true);option("indentUnit",2,loadMode,true);option("indentWithTabs",false);option("smartIndent",true);option("tabSize",4,function(cm){resetModeState(cm);clearCaches(cm);regChange(cm);},true);option("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,function(cm,val){cm.options.specialChars=new RegExp(val.source+(val.test("\t")?"":"|\t"),"g");cm.refresh();},true);option("specialCharPlaceholder",defaultSpecialCharPlaceholder,function(cm){cm.refresh();},true);option("electricChars",true);option("rtlMoveVisually",!windows);option("wholeLineUpdateBefore",true);option("theme","default",function(cm){themeChanged(cm);guttersChanged(cm);},true);option("keyMap","default",keyMapChanged);option("extraKeys",null);option("onKeyEvent",null);option("onDragEvent",null);option("lineWrapping",false,wrappingChanged,true);option("gutters",[],function(cm){setGuttersForLineNumbers(cm.options);guttersChanged(cm);},true);option("fixedGutter",true,function(cm,val){cm.display.gutters.style.left=val?compensateForHScroll(cm.display)+"px":"0";cm.refresh();},true);option("coverGutterNextToScrollbar",false,updateScrollbars,true);option("lineNumbers",false,function(cm){setGuttersForLineNumbers(cm.options);guttersChanged(cm);},true);option("firstLineNumber",1,guttersChanged,true);option("lineNumberFormatter",function(integer){return integer;},guttersChanged,true);option("showCursorWhenSelecting",false,updateSelection,true);option("resetSelectionOnContextMenu",true);option("readOnly",false,function(cm,val){if(val=="nocursor"){onBlur(cm);cm.display.input.blur();cm.display.disabled=true;}else{cm.display.disabled=false;if(!val)resetInput(cm,true);}});option("disableInput",false,function(cm,val){if(!val)resetInput(cm,true);},true);option("dragDrop",true);option("cursorBlinkRate",530);option("cursorScrollMargin",0);option("cursorHeight",1);option("workTime",100);option("workDelay",100);option("flattenSpans",true,resetModeState,true);option("addModeClass",false,resetModeState,true);option("pollInterval",100);option("undoDepth",40,function(cm,val){cm.doc.history.undoDepth=val;});option("historyEventDelay",500);option("viewportMargin",10,function(cm){cm.refresh();},true);option("maxHighlightLength",10000,resetModeState,true);option("crudeMeasuringFrom",10000);option("moveInputWithCursor",true,function(cm,val){if(!val)cm.display.inputDiv.style.top=cm.display.inputDiv.style.left=0;});option("tabindex",null,function(cm,val){cm.display.input.tabIndex=val||"";});option("autofocus",null);var modes=CodeMirror.modes={},mimeModes=CodeMirror.mimeModes={};CodeMirror.defineMode=function(name,mode){if(!CodeMirror.defaults.mode&&name!="null")CodeMirror.defaults.mode=name;if(arguments.length>2){mode.dependencies=[];for(var i=2;i<arguments.length;++i)mode.dependencies.push(arguments[i]);}
modes[name]=mode;};CodeMirror.defineMIME=function(mime,spec){mimeModes[mime]=spec;};CodeMirror.resolveMode=function(spec){if(typeof spec=="string"&&mimeModes.hasOwnProperty(spec)){spec=mimeModes[spec];}else if(spec&&typeof spec.name=="string"&&mimeModes.hasOwnProperty(spec.name)){var found=mimeModes[spec.name];spec=createObj(found,spec);spec.name=found.name;}else if(typeof spec=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(spec)){return CodeMirror.resolveMode("application/xml");}
if(typeof spec=="string")return{name:spec};else return spec||{name:"null"};};CodeMirror.getMode=function(options,spec){var spec=CodeMirror.resolveMode(spec);var mfactory=modes[spec.name];if(!mfactory)return CodeMirror.getMode(options,"text/plain");var modeObj=mfactory(options,spec);if(modeExtensions.hasOwnProperty(spec.name)){var exts=modeExtensions[spec.name];for(var prop in exts){if(!exts.hasOwnProperty(prop))continue;if(modeObj.hasOwnProperty(prop))modeObj["_"+prop]=modeObj[prop];modeObj[prop]=exts[prop];}}
-modeObj.name=spec.name;return modeObj;};CodeMirror.defineMode("null",function(){return{token:function(stream){stream.skipToEnd();}};});CodeMirror.defineMIME("text/plain","null");var modeExtensions=CodeMirror.modeExtensions={};CodeMirror.extendMode=function(mode,properties){var exts=modeExtensions.hasOwnProperty(mode)?modeExtensions[mode]:(modeExtensions[mode]={});copyObj(properties,exts);};CodeMirror.defineExtension=function(name,func){CodeMirror.prototype[name]=func;};CodeMirror.defineDocExtension=function(name,func){Doc.prototype[name]=func;};CodeMirror.defineOption=option;var initHooks=[];CodeMirror.defineInitHook=function(f){initHooks.push(f);};var helpers=CodeMirror.helpers={};CodeMirror.registerHelper=function(type,name,value){if(!helpers.hasOwnProperty(type))helpers[type]=CodeMirror[type]={};helpers[type][name]=value;};CodeMirror.isWordChar=isWordChar;function copyState(mode,state){if(state===true)return state;if(mode.copyState)return mode.copyState(state);var nstate={};for(var n in state){var val=state[n];if(val instanceof Array)val=val.concat([]);nstate[n]=val;}
+modeObj.name=spec.name;if(spec.helperType)modeObj.helperType=spec.helperType;if(spec.modeProps)for(var prop in spec.modeProps)
+modeObj[prop]=spec.modeProps[prop];return modeObj;};CodeMirror.defineMode("null",function(){return{token:function(stream){stream.skipToEnd();}};});CodeMirror.defineMIME("text/plain","null");var modeExtensions=CodeMirror.modeExtensions={};CodeMirror.extendMode=function(mode,properties){var exts=modeExtensions.hasOwnProperty(mode)?modeExtensions[mode]:(modeExtensions[mode]={});copyObj(properties,exts);};CodeMirror.defineExtension=function(name,func){CodeMirror.prototype[name]=func;};CodeMirror.defineDocExtension=function(name,func){Doc.prototype[name]=func;};CodeMirror.defineOption=option;var initHooks=[];CodeMirror.defineInitHook=function(f){initHooks.push(f);};var helpers=CodeMirror.helpers={};CodeMirror.registerHelper=function(type,name,value){if(!helpers.hasOwnProperty(type))helpers[type]=CodeMirror[type]={_global:[]};helpers[type][name]=value;};CodeMirror.registerGlobalHelper=function(type,name,predicate,value){CodeMirror.registerHelper(type,name,value);helpers[type]._global.push({pred:predicate,val:value});};CodeMirror.isWordChar=isWordChar;function copyState(mode,state){if(state===true)return state;if(mode.copyState)return mode.copyState(state);var nstate={};for(var n in state){var val=state[n];if(val instanceof Array)val=val.concat([]);nstate[n]=val;}
return nstate;}
CodeMirror.copyState=copyState;function startState(mode,a1,a2){return mode.startState?mode.startState(a1,a2):true;}
CodeMirror.startState=startState;CodeMirror.innerMode=function(mode,state){while(mode.innerMode){var info=mode.innerMode(state);if(!info||info.mode==mode)break;state=info.state;mode=info.mode;}
@@ -433,32 +448,32 @@
function save(){textarea.value=cm.getValue();}
if(textarea.form){on(textarea.form,"submit",save);if(!options.leaveSubmitMethodAlone){var form=textarea.form,realSubmit=form.submit;try{var wrappedSubmit=form.submit=function(){save();form.submit=realSubmit;form.submit();form.submit=wrappedSubmit;};}catch(e){}}}
textarea.style.display="none";var cm=CodeMirror(function(node){textarea.parentNode.insertBefore(node,textarea.nextSibling);},options);cm.save=save;cm.getTextArea=function(){return textarea;};cm.toTextArea=function(){save();textarea.parentNode.removeChild(cm.getWrapperElement());textarea.style.display="";if(textarea.form){off(textarea.form,"submit",save);if(typeof textarea.form.submit=="function")
-textarea.form.submit=realSubmit;}};return cm;};function StringStream(string,tabSize){this.pos=this.start=0;this.string=string;this.tabSize=tabSize||8;this.lastColumnPos=this.lastColumnValue=0;}
-StringStream.prototype={eol:function(){return this.pos>=this.string.length;},sol:function(){return this.pos==0;},peek:function(){return this.string.charAt(this.pos)||undefined;},next:function(){if(this.pos<this.string.length)
+textarea.form.submit=realSubmit;}};return cm;};function StringStream(string,tabSize){this.pos=this.start=0;this.string=string;this.tabSize=tabSize||8;this.lastColumnPos=this.lastColumnValue=0;this.lineStart=0;}
+StringStream.prototype={eol:function(){return this.pos>=this.string.length;},sol:function(){return this.pos==this.lineStart;},peek:function(){return this.string.charAt(this.pos)||undefined;},next:function(){if(this.pos<this.string.length)
return this.string.charAt(this.pos++);},eat:function(match){var ch=this.string.charAt(this.pos);if(typeof match=="string")var ok=ch==match;else var ok=ch&&(match.test?match.test(ch):match(ch));if(ok){++this.pos;return ch;}},eatWhile:function(match){var start=this.pos;while(this.eat(match)){}
return this.pos>start;},eatSpace:function(){var start=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>start;},skipToEnd:function(){this.pos=this.string.length;},skipTo:function(ch){var found=this.string.indexOf(ch,this.pos);if(found>-1){this.pos=found;return true;}},backUp:function(n){this.pos-=n;},column:function(){if(this.lastColumnPos<this.start){this.lastColumnValue=countColumn(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue);this.lastColumnPos=this.start;}
-return this.lastColumnValue;},indentation:function(){return countColumn(this.string,null,this.tabSize);},match:function(pattern,consume,caseInsensitive){if(typeof pattern=="string"){var cased=function(str){return caseInsensitive?str.toLowerCase():str;};var substr=this.string.substr(this.pos,pattern.length);if(cased(substr)==cased(pattern)){if(consume!==false)this.pos+=pattern.length;return true;}}else{var match=this.string.slice(this.pos).match(pattern);if(match&&match.index>0)return null;if(match&&consume!==false)this.pos+=match[0].length;return match;}},current:function(){return this.string.slice(this.start,this.pos);}};CodeMirror.StringStream=StringStream;function TextMarker(doc,type){this.lines=[];this.type=type;this.doc=doc;}
+return this.lastColumnValue-(this.lineStart?countColumn(this.string,this.lineStart,this.tabSize):0);},indentation:function(){return countColumn(this.string,null,this.tabSize)-
+(this.lineStart?countColumn(this.string,this.lineStart,this.tabSize):0);},match:function(pattern,consume,caseInsensitive){if(typeof pattern=="string"){var cased=function(str){return caseInsensitive?str.toLowerCase():str;};var substr=this.string.substr(this.pos,pattern.length);if(cased(substr)==cased(pattern)){if(consume!==false)this.pos+=pattern.length;return true;}}else{var match=this.string.slice(this.pos).match(pattern);if(match&&match.index>0)return null;if(match&&consume!==false)this.pos+=match[0].length;return match;}},current:function(){return this.string.slice(this.start,this.pos);},hideFirstChars:function(n,inner){this.lineStart+=n;try{return inner();}
+finally{this.lineStart-=n;}}};CodeMirror.StringStream=StringStream;function TextMarker(doc,type){this.lines=[];this.type=type;this.doc=doc;}
CodeMirror.TextMarker=TextMarker;eventMixin(TextMarker);TextMarker.prototype.clear=function(){if(this.explicitlyCleared)return;var cm=this.doc.cm,withOp=cm&&!cm.curOp;if(withOp)startOperation(cm);if(hasHandler(this,"clear")){var found=this.find();if(found)signalLater(this,"clear",found.from,found.to);}
var min=null,max=null;for(var i=0;i<this.lines.length;++i){var line=this.lines[i];var span=getMarkedSpanFor(line.markedSpans,this);if(span.to!=null)max=lineNo(line);line.markedSpans=removeMarkedSpan(line.markedSpans,span);if(span.from!=null)
min=lineNo(line);else if(this.collapsed&&!lineIsHidden(this.doc,line)&&cm)
updateLineHeight(line,textHeight(cm.display));}
if(cm&&this.collapsed&&!cm.options.lineWrapping)for(var i=0;i<this.lines.length;++i){var visual=visualLine(cm.doc,this.lines[i]),len=lineLength(cm.doc,visual);if(len>cm.display.maxLineLength){cm.display.maxLine=visual;cm.display.maxLineLength=len;cm.display.maxLineChanged=true;}}
if(min!=null&&cm)regChange(cm,min,max+1);this.lines.length=0;this.explicitlyCleared=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;if(cm)reCheckSelection(cm);}
-if(withOp)endOperation(cm);};TextMarker.prototype.find=function(){var from,to;for(var i=0;i<this.lines.length;++i){var line=this.lines[i];var span=getMarkedSpanFor(line.markedSpans,this);if(span.from!=null||span.to!=null){var found=lineNo(line);if(span.from!=null)from=Pos(found,span.from);if(span.to!=null)to=Pos(found,span.to);}}
-if(this.type=="bookmark")return from;return from&&{from:from,to:to};};TextMarker.prototype.changed=function(){var pos=this.find(),cm=this.doc.cm;if(!pos||!cm)return;if(this.type!="bookmark")pos=pos.from;var line=getLine(this.doc,pos.line);clearCachedMeasurement(cm,line);if(pos.line>=cm.display.showingFrom&&pos.line<cm.display.showingTo){for(var node=cm.display.lineDiv.firstChild;node;node=node.nextSibling)if(node.lineObj==line){if(node.offsetHeight!=line.height)updateLineHeight(line,node.offsetHeight);break;}
+if(withOp)endOperation(cm);};TextMarker.prototype.find=function(bothSides){var from,to;for(var i=0;i<this.lines.length;++i){var line=this.lines[i];var span=getMarkedSpanFor(line.markedSpans,this);if(span.from!=null||span.to!=null){var found=lineNo(line);if(span.from!=null)from=Pos(found,span.from);if(span.to!=null)to=Pos(found,span.to);}}
+if(this.type=="bookmark"&&!bothSides)return from;return from&&{from:from,to:to};};TextMarker.prototype.changed=function(){var pos=this.find(),cm=this.doc.cm;if(!pos||!cm)return;if(this.type!="bookmark")pos=pos.from;var line=getLine(this.doc,pos.line);clearCachedMeasurement(cm,line);if(pos.line>=cm.display.showingFrom&&pos.line<cm.display.showingTo){for(var node=cm.display.lineDiv.firstChild;node;node=node.nextSibling)if(node.lineObj==line){if(node.offsetHeight!=line.height)updateLineHeight(line,node.offsetHeight);break;}
runInOp(cm,function(){cm.curOp.selectionChanged=cm.curOp.forceUpdate=cm.curOp.updateMaxLine=true;});}};TextMarker.prototype.attachLine=function(line){if(!this.lines.length&&this.doc.cm){var op=this.doc.cm.curOp;if(!op.maybeHiddenMarkers||indexOf(op.maybeHiddenMarkers,this)==-1)
(op.maybeUnhiddenMarkers||(op.maybeUnhiddenMarkers=[])).push(this);}
-this.lines.push(line);};TextMarker.prototype.detachLine=function(line){this.lines.splice(indexOf(this.lines,line),1);if(!this.lines.length&&this.doc.cm){var op=this.doc.cm.curOp;(op.maybeHiddenMarkers||(op.maybeHiddenMarkers=[])).push(this);}};function markText(doc,from,to,options,type){if(options&&options.shared)return markTextShared(doc,from,to,options,type);if(doc.cm&&!doc.cm.curOp)return operation(doc.cm,markText)(doc,from,to,options,type);var marker=new TextMarker(doc,type);if(posLess(to,from)||posEq(from,to)&&type=="range"&&!(options.inclusiveLeft&&options.inclusiveRight))
-return marker;if(options)copyObj(options,marker);if(marker.replacedWith){marker.collapsed=true;marker.replacedWith=elt("span",[marker.replacedWith],"CodeMirror-widget");if(!options.handleMouseEvents)marker.replacedWith.ignoreEvents=true;}
-if(marker.collapsed)sawCollapsedSpans=true;if(marker.addToHistory)
-addToHistory(doc,{from:from,to:to,origin:"markText"},{head:doc.sel.head,anchor:doc.sel.anchor},NaN);var curLine=from.line,size=0,collapsedAtStart,collapsedAtEnd,cm=doc.cm,updateMaxLine;doc.iter(curLine,to.line+1,function(line){if(cm&&marker.collapsed&&!cm.options.lineWrapping&&visualLine(doc,line)==cm.display.maxLine)
-updateMaxLine=true;var span={from:null,to:null,marker:marker};size+=line.text.length;if(curLine==from.line){span.from=from.ch;size-=from.ch;}
-if(curLine==to.line){span.to=to.ch;size-=line.text.length-to.ch;}
-if(marker.collapsed){if(curLine==to.line)collapsedAtEnd=collapsedSpanAt(line,to.ch);if(curLine==from.line)collapsedAtStart=collapsedSpanAt(line,from.ch);else updateLineHeight(line,0);}
-addMarkedSpan(line,span);++curLine;});if(marker.collapsed)doc.iter(from.line,to.line+1,function(line){if(lineIsHidden(doc,line))updateLineHeight(line,0);});if(marker.clearOnEnter)on(marker,"beforeCursorEnter",function(){marker.clear();});if(marker.readOnly){sawReadOnlySpans=true;if(doc.history.done.length||doc.history.undone.length)
+this.lines.push(line);};TextMarker.prototype.detachLine=function(line){this.lines.splice(indexOf(this.lines,line),1);if(!this.lines.length&&this.doc.cm){var op=this.doc.cm.curOp;(op.maybeHiddenMarkers||(op.maybeHiddenMarkers=[])).push(this);}};var nextMarkerId=0;function markText(doc,from,to,options,type){if(options&&options.shared)return markTextShared(doc,from,to,options,type);if(doc.cm&&!doc.cm.curOp)return operation(doc.cm,markText)(doc,from,to,options,type);var marker=new TextMarker(doc,type);if(options)copyObj(options,marker);if(posLess(to,from)||posEq(from,to)&&marker.clearWhenEmpty!==false)
+return marker;if(marker.replacedWith){marker.collapsed=true;marker.replacedWith=elt("span",[marker.replacedWith],"CodeMirror-widget");if(!options.handleMouseEvents)marker.replacedWith.ignoreEvents=true;}
+if(marker.collapsed){if(conflictingCollapsedRange(doc,from.line,from,to,marker)||from.line!=to.line&&conflictingCollapsedRange(doc,to.line,from,to,marker))
+throw new Error("Inserting collapsed marker partially overlapping an existing one");sawCollapsedSpans=true;}
+if(marker.addToHistory)
+addToHistory(doc,{from:from,to:to,origin:"markText"},{head:doc.sel.head,anchor:doc.sel.anchor},NaN);var curLine=from.line,cm=doc.cm,updateMaxLine;doc.iter(curLine,to.line+1,function(line){if(cm&&marker.collapsed&&!cm.options.lineWrapping&&visualLine(doc,line)==cm.display.maxLine)
+updateMaxLine=true;var span={from:null,to:null,marker:marker};if(curLine==from.line)span.from=from.ch;if(curLine==to.line)span.to=to.ch;if(marker.collapsed&&curLine!=from.line)updateLineHeight(line,0);addMarkedSpan(line,span);++curLine;});if(marker.collapsed)doc.iter(from.line,to.line+1,function(line){if(lineIsHidden(doc,line))updateLineHeight(line,0);});if(marker.clearOnEnter)on(marker,"beforeCursorEnter",function(){marker.clear();});if(marker.readOnly){sawReadOnlySpans=true;if(doc.history.done.length||doc.history.undone.length)
doc.clearHistory();}
-if(marker.collapsed){if(collapsedAtStart!=collapsedAtEnd)
-throw new Error("Inserting collapsed marker overlapping an existing one");marker.size=size;marker.atomic=true;}
+if(marker.collapsed){marker.id=++nextMarkerId;marker.atomic=true;}
if(cm){if(updateMaxLine)cm.curOp.updateMaxLine=true;if(marker.className||marker.title||marker.startStyle||marker.endStyle||marker.collapsed)
regChange(cm,from.line,to.line+1);if(marker.atomic)reCheckSelection(cm);}
return marker;}
@@ -470,21 +485,21 @@
function removeMarkedSpan(spans,span){for(var r,i=0;i<spans.length;++i)
if(spans[i]!=span)(r||(r=[])).push(spans[i]);return r;}
function addMarkedSpan(line,span){line.markedSpans=line.markedSpans?line.markedSpans.concat([span]):[span];span.marker.attachLine(line);}
-function markedSpansBefore(old,startCh,isInsert){if(old)for(var i=0,nw;i<old.length;++i){var span=old[i],marker=span.marker;var startsBefore=span.from==null||(marker.inclusiveLeft?span.from<=startCh:span.from<startCh);if(startsBefore||(marker.inclusiveLeft&&marker.inclusiveRight||marker.type=="bookmark")&&span.from==startCh&&(!isInsert||!span.marker.insertLeft)){var endsAfter=span.to==null||(marker.inclusiveRight?span.to>=startCh:span.to>startCh);(nw||(nw=[])).push({from:span.from,to:endsAfter?null:span.to,marker:marker});}}
+function markedSpansBefore(old,startCh,isInsert){if(old)for(var i=0,nw;i<old.length;++i){var span=old[i],marker=span.marker;var startsBefore=span.from==null||(marker.inclusiveLeft?span.from<=startCh:span.from<startCh);if(startsBefore||span.from==startCh&&marker.type=="bookmark"&&(!isInsert||!span.marker.insertLeft)){var endsAfter=span.to==null||(marker.inclusiveRight?span.to>=startCh:span.to>startCh);(nw||(nw=[])).push({from:span.from,to:endsAfter?null:span.to,marker:marker});}}
return nw;}
-function markedSpansAfter(old,endCh,isInsert){if(old)for(var i=0,nw;i<old.length;++i){var span=old[i],marker=span.marker;var endsAfter=span.to==null||(marker.inclusiveRight?span.to>=endCh:span.to>endCh);if(endsAfter||marker.type=="bookmark"&&span.from==endCh&&(!isInsert||span.marker.insertLeft)){var startsBefore=span.from==null||(marker.inclusiveLeft?span.from<=endCh:span.from<endCh);(nw||(nw=[])).push({from:startsBefore?null:span.from-endCh,to:span.to==null?null:span.to-endCh,marker:marker});}}
+function markedSpansAfter(old,endCh,isInsert){if(old)for(var i=0,nw;i<old.length;++i){var span=old[i],marker=span.marker;var endsAfter=span.to==null||(marker.inclusiveRight?span.to>=endCh:span.to>endCh);if(endsAfter||span.from==endCh&&marker.type=="bookmark"&&(!isInsert||span.marker.insertLeft)){var startsBefore=span.from==null||(marker.inclusiveLeft?span.from<=endCh:span.from<endCh);(nw||(nw=[])).push({from:startsBefore?null:span.from-endCh,to:span.to==null?null:span.to-endCh,marker:marker});}}
return nw;}
function stretchSpansOverChange(doc,change){var oldFirst=isLine(doc,change.from.line)&&getLine(doc,change.from.line).markedSpans;var oldLast=isLine(doc,change.to.line)&&getLine(doc,change.to.line).markedSpans;if(!oldFirst&&!oldLast)return null;var startCh=change.from.ch,endCh=change.to.ch,isInsert=posEq(change.from,change.to);var first=markedSpansBefore(oldFirst,startCh,isInsert);var last=markedSpansAfter(oldLast,endCh,isInsert);var sameLine=change.text.length==1,offset=lst(change.text).length+(sameLine?startCh:0);if(first){for(var i=0;i<first.length;++i){var span=first[i];if(span.to==null){var found=getMarkedSpanFor(last,span.marker);if(!found)span.to=startCh;else if(sameLine)span.to=found.to==null?null:found.to+offset;}}}
if(last){for(var i=0;i<last.length;++i){var span=last[i];if(span.to!=null)span.to+=offset;if(span.from==null){var found=getMarkedSpanFor(first,span.marker);if(!found){span.from=offset;if(sameLine)(first||(first=[])).push(span);}}else{span.from+=offset;if(sameLine)(first||(first=[])).push(span);}}}
-if(sameLine&&first){for(var i=0;i<first.length;++i)
-if(first[i].from!=null&&first[i].from==first[i].to&&first[i].marker.type!="bookmark")
-first.splice(i--,1);if(!first.length)first=null;}
-var newMarkers=[first];if(!sameLine){var gap=change.text.length-2,gapMarkers;if(gap>0&&first)
+if(first)first=clearEmptySpans(first);if(last&&last!=first)last=clearEmptySpans(last);var newMarkers=[first];if(!sameLine){var gap=change.text.length-2,gapMarkers;if(gap>0&&first)
for(var i=0;i<first.length;++i)
if(first[i].to==null)
(gapMarkers||(gapMarkers=[])).push({from:null,to:null,marker:first[i].marker});for(var i=0;i<gap;++i)
newMarkers.push(gapMarkers);newMarkers.push(last);}
return newMarkers;}
+function clearEmptySpans(spans){for(var i=0;i<spans.length;++i){var span=spans[i];if(span.from!=null&&span.from==span.to&&span.marker.clearWhenEmpty!==false)
+spans.splice(i--,1);}
+if(!spans.length)return null;return spans;}
function mergeOldSpans(doc,change){var old=getOldSpans(doc,change);var stretched=stretchSpansOverChange(doc,change);if(!old)return stretched;if(!stretched)return old;for(var i=0;i<old.length;++i){var oldCur=old[i],stretchCur=stretched[i];if(oldCur&&stretchCur){spans:for(var j=0;j<stretchCur.length;++j){var span=stretchCur[j];for(var k=0;k<oldCur.length;++k)
if(oldCur[k].marker==span.marker)continue spans;oldCur.push(span);}}else if(stretchCur){old[i]=stretchCur;}}
return old;}
@@ -493,18 +508,23 @@
newParts.push({from:p.from,to:m.from});if(posLess(m.to,p.to)||!mk.inclusiveRight&&posEq(p.to,m.to))
newParts.push({from:m.to,to:p.to});parts.splice.apply(parts,newParts);j+=newParts.length-1;}}
return parts;}
-function collapsedSpanAt(line,ch){var sps=sawCollapsedSpans&&line.markedSpans,found;if(sps)for(var sp,i=0;i<sps.length;++i){sp=sps[i];if(!sp.marker.collapsed)continue;if((sp.from==null||sp.from<ch)&&(sp.to==null||sp.to>ch)&&(!found||found.width<sp.marker.width))
+function extraLeft(marker){return marker.inclusiveLeft?-1:0;}
+function extraRight(marker){return marker.inclusiveRight?1:0;}
+function compareCollapsedMarkers(a,b){var lenDiff=a.lines.length-b.lines.length;if(lenDiff!=0)return lenDiff;var aPos=a.find(),bPos=b.find();var fromCmp=cmp(aPos.from,bPos.from)||extraLeft(a)-extraLeft(b);if(fromCmp)return-fromCmp;var toCmp=cmp(aPos.to,bPos.to)||extraRight(a)-extraRight(b);if(toCmp)return toCmp;return b.id-a.id;}
+function collapsedSpanAtSide(line,start){var sps=sawCollapsedSpans&&line.markedSpans,found;if(sps)for(var sp,i=0;i<sps.length;++i){sp=sps[i];if(sp.marker.collapsed&&(start?sp.from:sp.to)==null&&(!found||compareCollapsedMarkers(found,sp.marker)<0))
found=sp.marker;}
return found;}
-function collapsedSpanAtStart(line){return collapsedSpanAt(line,-1);}
-function collapsedSpanAtEnd(line){return collapsedSpanAt(line,line.text.length+1);}
+function collapsedSpanAtStart(line){return collapsedSpanAtSide(line,true);}
+function collapsedSpanAtEnd(line){return collapsedSpanAtSide(line,false);}
+function conflictingCollapsedRange(doc,lineNo,from,to,marker){var line=getLine(doc,lineNo);var sps=sawCollapsedSpans&&line.markedSpans;if(sps)for(var i=0;i<sps.length;++i){var sp=sps[i];if(!sp.marker.collapsed)continue;var found=sp.marker.find(true);var fromCmp=cmp(found.from,from)||extraLeft(sp.marker)-extraLeft(marker);var toCmp=cmp(found.to,to)||extraRight(sp.marker)-extraRight(marker);if(fromCmp>=0&&toCmp<=0||fromCmp<=0&&toCmp>=0)continue;if(fromCmp<=0&&(cmp(found.to,from)||extraRight(sp.marker)-extraLeft(marker))>0||fromCmp>=0&&(cmp(found.from,to)||extraLeft(sp.marker)-extraRight(marker))<0)
+return true;}}
function visualLine(doc,line){var merged;while(merged=collapsedSpanAtStart(line))
line=getLine(doc,merged.find().from.line);return line;}
function lineIsHidden(doc,line){var sps=sawCollapsedSpans&&line.markedSpans;if(sps)for(var sp,i=0;i<sps.length;++i){sp=sps[i];if(!sp.marker.collapsed)continue;if(sp.from==null)return true;if(sp.marker.replacedWith)continue;if(sp.from==0&&sp.marker.inclusiveLeft&&lineIsHiddenInner(doc,line,sp))
return true;}}
function lineIsHiddenInner(doc,line,span){if(span.to==null){var end=span.marker.find().to,endLine=getLine(doc,end.line);return lineIsHiddenInner(doc,endLine,getMarkedSpanFor(endLine.markedSpans,span.marker));}
if(span.marker.inclusiveRight&&span.to==line.text.length)
-return true;for(var sp,i=0;i<line.markedSpans.length;++i){sp=line.markedSpans[i];if(sp.marker.collapsed&&!sp.marker.replacedWith&&sp.from==span.to&&(sp.marker.inclusiveLeft||span.marker.inclusiveRight)&&lineIsHiddenInner(doc,line,sp))return true;}}
+return true;for(var sp,i=0;i<line.markedSpans.length;++i){sp=line.markedSpans[i];if(sp.marker.collapsed&&!sp.marker.replacedWith&&sp.from==span.to&&(sp.to==null||sp.to!=span.from)&&(sp.marker.inclusiveLeft||span.marker.inclusiveRight)&&lineIsHiddenInner(doc,line,sp))return true;}}
function detachMarkedSpans(line){var spans=line.markedSpans;if(!spans)return;for(var i=0;i<spans.length;++i)
spans[i].marker.detachLine(line);line.markedSpans=null;}
function attachMarkedSpans(line,spans){if(!spans)return;for(var i=0;i<spans.length;++i)
@@ -520,6 +540,7 @@
var Line=CodeMirror.Line=function(text,markedSpans,estimateHeight){this.text=text;attachMarkedSpans(this,markedSpans);this.height=estimateHeight?estimateHeight(this):1;};eventMixin(Line);Line.prototype.lineNo=function(){return lineNo(this);};function updateLine(line,text,markedSpans,estimateHeight){line.text=text;if(line.stateAfter)line.stateAfter=null;if(line.styles)line.styles=null;if(line.order!=null)line.order=null;detachMarkedSpans(line);attachMarkedSpans(line,markedSpans);var estHeight=estimateHeight?estimateHeight(line):1;if(estHeight!=line.height)updateLineHeight(line,estHeight);}
function cleanUpLine(line){line.parent=null;detachMarkedSpans(line);}
function runMode(cm,text,mode,state,f,forceToEnd){var flattenSpans=mode.flattenSpans;if(flattenSpans==null)flattenSpans=cm.options.flattenSpans;var curStart=0,curStyle=null;var stream=new StringStream(text,cm.options.tabSize),style;if(text==""&&mode.blankLine)mode.blankLine(state);while(!stream.eol()){if(stream.pos>cm.options.maxHighlightLength){flattenSpans=false;if(forceToEnd)processLine(cm,text,state,stream.pos);stream.pos=text.length;style=null;}else{style=mode.token(stream,state);}
+if(cm.options.addModeClass){var mName=CodeMirror.innerMode(mode,state).mode.name;if(mName)style="m-"+(style?mName+" "+style:mName);}
if(!flattenSpans||curStyle!=style){if(curStart<stream.start)f(stream.start,curStyle);curStart=stream.start;curStyle=style;}
stream.start=stream.pos;}
while(curStart<stream.pos){var pos=Math.min(stream.pos,curStart+50000);f(pos,curStyle);curStart=pos;}}
@@ -530,24 +551,24 @@
function getLineStyles(cm,line){if(!line.styles||line.styles[0]!=cm.state.modeGen)
line.styles=highlightLine(cm,line,line.stateAfter=getStateBefore(cm,lineNo(line)));return line.styles;}
function processLine(cm,text,state,startAt){var mode=cm.doc.mode;var stream=new StringStream(text,cm.options.tabSize);stream.start=stream.pos=startAt||0;if(text==""&&mode.blankLine)mode.blankLine(state);while(!stream.eol()&&stream.pos<=cm.options.maxHighlightLength){mode.token(stream,state);stream.start=stream.pos;}}
-var styleToClassCache={};function interpretTokenStyle(style,builder){if(!style)return null;for(;;){var lineClass=style.match(/(?:^|\s)line-(background-)?(\S+)/);if(!lineClass)break;style=style.slice(0,lineClass.index)+style.slice(lineClass.index+lineClass[0].length);var prop=lineClass[1]?"bgClass":"textClass";if(builder[prop]==null)
+var styleToClassCache={},styleToClassCacheWithMode={};function interpretTokenStyle(style,builder){if(!style)return null;for(;;){var lineClass=style.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!lineClass)break;style=style.slice(0,lineClass.index)+style.slice(lineClass.index+lineClass[0].length);var prop=lineClass[1]?"bgClass":"textClass";if(builder[prop]==null)
builder[prop]=lineClass[2];else if(!(new RegExp("(?:^|\s)"+lineClass[2]+"(?:$|\s)")).test(builder[prop]))
builder[prop]+=" "+lineClass[2];}
-return styleToClassCache[style]||(styleToClassCache[style]="cm-"+style.replace(/ +/g," cm-"));}
+if(/^\s*$/.test(style))return null;var cache=builder.cm.options.addModeClass?styleToClassCacheWithMode:styleToClassCache;return cache[style]||(cache[style]=style.replace(/\S+/g,"cm-$&"));}
function buildLineContent(cm,realLine,measure,copyWidgets){var merged,line=realLine,empty=true;while(merged=collapsedSpanAtStart(line))
-line=getLine(cm.doc,merged.find().from.line);var builder={pre:elt("pre"),col:0,pos:0,measure:null,measuredSomething:false,cm:cm,copyWidgets:copyWidgets};do{if(line.text)empty=false;builder.measure=line==realLine&&measure;builder.pos=0;builder.addToken=builder.measure?buildTokenMeasure:buildToken;if((ie||webkit)&&cm.getOption("lineWrapping"))
+line=getLine(cm.doc,merged.find().from.line);var builder={pre:elt("pre"),col:0,pos:0,measure:null,measuredSomething:false,cm:cm,copyWidgets:copyWidgets};do{if(line.text)empty=false;builder.measure=line==realLine&&measure;builder.pos=0;builder.addToken=builder.measure?buildTokenMeasure:buildToken;if((old_ie||webkit)&&cm.getOption("lineWrapping"))
builder.addToken=buildTokenSplitSpaces(builder.addToken);var next=insertLineContent(line,builder,getLineStyles(cm,line));if(measure&&line==realLine&&!builder.measuredSomething){measure[0]=builder.pre.appendChild(zeroWidthElement(cm.display.measure));builder.measuredSomething=true;}
if(next)line=getLine(cm.doc,next.to.line);}while(next);if(measure&&!builder.measuredSomething&&!measure[0])
measure[0]=builder.pre.appendChild(empty?elt("span","\u00a0"):zeroWidthElement(cm.display.measure));if(!builder.pre.firstChild&&!lineIsHidden(cm.doc,realLine))
-builder.pre.appendChild(document.createTextNode("\u00a0"));var order;if(measure&&(ie||ie_gt10)&&(order=getOrder(line))){var l=order.length-1;if(order[l].from==order[l].to)--l;var last=order[l],prev=order[l-1];if(last.from+1==last.to&&prev&&last.level<prev.level){var span=measure[builder.pos-1];if(span)span.parentNode.insertBefore(span.measureRight=zeroWidthElement(cm.display.measure),span.nextSibling);}}
+builder.pre.appendChild(document.createTextNode("\u00a0"));var order;if(measure&&ie&&(order=getOrder(line))){var l=order.length-1;if(order[l].from==order[l].to)--l;var last=order[l],prev=order[l-1];if(last.from+1==last.to&&prev&&last.level<prev.level){var span=measure[builder.pos-1];if(span)span.parentNode.insertBefore(span.measureRight=zeroWidthElement(cm.display.measure),span.nextSibling);}}
var textClass=builder.textClass?builder.textClass+" "+(realLine.textClass||""):realLine.textClass;if(textClass)builder.pre.className=textClass;signal(cm,"renderLine",cm,realLine,builder.pre);return builder;}
function defaultSpecialCharPlaceholder(ch){var token=elt("span","\u2022","cm-invalidchar");token.title="\\u"+ch.charCodeAt(0).toString(16);return token;}
function buildToken(builder,text,style,startStyle,endStyle,title){if(!text)return;var special=builder.cm.options.specialChars;if(!special.test(text)){builder.col+=text.length;var content=document.createTextNode(text);}else{var content=document.createDocumentFragment(),pos=0;while(true){special.lastIndex=pos;var m=special.exec(text);var skipped=m?m.index-pos:text.length-pos;if(skipped){content.appendChild(document.createTextNode(text.slice(pos,pos+skipped)));builder.col+=skipped;}
if(!m)break;pos+=skipped+1;if(m[0]=="\t"){var tabSize=builder.cm.options.tabSize,tabWidth=tabSize-builder.col%tabSize;content.appendChild(elt("span",spaceStr(tabWidth),"cm-tab"));builder.col+=tabWidth;}else{var token=builder.cm.options.specialCharPlaceholder(m[0]);content.appendChild(token);builder.col+=1;}}}
if(style||startStyle||endStyle||builder.measure){var fullStyle=style||"";if(startStyle)fullStyle+=startStyle;if(endStyle)fullStyle+=endStyle;var token=elt("span",[content],fullStyle);if(title)token.title=title;return builder.pre.appendChild(token);}
builder.pre.appendChild(content);}
-function buildTokenMeasure(builder,text,style,startStyle,endStyle){var wrapping=builder.cm.options.lineWrapping;for(var i=0;i<text.length;++i){var ch=text.charAt(i),start=i==0;if(ch>="\ud800"&&ch<"\udbff"&&i<text.length-1){ch=text.slice(i,i+2);++i;}else if(i&&wrapping&&spanAffectsWrapping(text,i)){builder.pre.appendChild(elt("wbr"));}
-var old=builder.measure[builder.pos];var span=builder.measure[builder.pos]=buildToken(builder,ch,style,start&&startStyle,i==text.length-1&&endStyle);if(old)span.leftSide=old.leftSide||old;if(ie&&wrapping&&ch==" "&&i&&!/\s/.test(text.charAt(i-1))&&i<text.length-1&&!/\s/.test(text.charAt(i+1)))
+function buildTokenMeasure(builder,text,style,startStyle,endStyle){var wrapping=builder.cm.options.lineWrapping;for(var i=0;i<text.length;++i){var start=i==0,to=i+1;while(to<text.length&&isExtendingChar(text.charAt(to)))++to;var ch=text.slice(i,to);i=to-1;if(i&&wrapping&&spanAffectsWrapping(text,i))
+builder.pre.appendChild(elt("wbr"));var old=builder.measure[builder.pos];var span=builder.measure[builder.pos]=buildToken(builder,ch,style,start&&startStyle,i==text.length-1&&endStyle);if(old)span.leftSide=old.leftSide||old;if(old_ie&&wrapping&&ch==" "&&i&&!/\s/.test(text.charAt(i-1))&&i<text.length-1&&!/\s/.test(text.charAt(i+1)))
span.style.whiteSpace="normal";builder.pos+=ch.length;}
if(text.length)builder.measuredSomething=true;}
function buildTokenSplitSpaces(inner){function split(old){var out=" ";for(var i=0;i<old.length-2;++i)out+=i%2?" ":"\u00a0";out+=" ";return out;}
@@ -561,7 +582,7 @@
function insertLineContent(line,builder,styles){var spans=line.markedSpans,allText=line.text,at=0;if(!spans){for(var i=1;i<styles.length;i+=2)
builder.addToken(builder,allText.slice(at,at=styles[i]),interpretTokenStyle(styles[i+1],builder));return;}
var len=allText.length,pos=0,i=1,text="",style;var nextChange=0,spanStyle,spanEndStyle,spanStartStyle,title,collapsed;for(;;){if(nextChange==pos){spanStyle=spanEndStyle=spanStartStyle=title="";collapsed=null;nextChange=Infinity;var foundBookmarks=[];for(var j=0;j<spans.length;++j){var sp=spans[j],m=sp.marker;if(sp.from<=pos&&(sp.to==null||sp.to>pos)){if(sp.to!=null&&nextChange>sp.to){nextChange=sp.to;spanEndStyle="";}
-if(m.className)spanStyle+=" "+m.className;if(m.startStyle&&sp.from==pos)spanStartStyle+=" "+m.startStyle;if(m.endStyle&&sp.to==nextChange)spanEndStyle+=" "+m.endStyle;if(m.title&&!title)title=m.title;if(m.collapsed&&(!collapsed||collapsed.marker.size<m.size))
+if(m.className)spanStyle+=" "+m.className;if(m.startStyle&&sp.from==pos)spanStartStyle+=" "+m.startStyle;if(m.endStyle&&sp.to==nextChange)spanEndStyle+=" "+m.endStyle;if(m.title&&!title)title=m.title;if(m.collapsed&&(!collapsed||compareCollapsedMarkers(collapsed.marker,m)<0))
collapsed=sp;}else if(sp.from>pos&&nextChange>sp.from){nextChange=sp.from;}
if(m.type=="bookmark"&&sp.from==pos&&m.replacedWith)foundBookmarks.push(m);}
if(collapsed&&(collapsed.from||0)==pos){buildCollapsedSpan(builder,(collapsed.to==null?len:collapsed.to)-pos,collapsed.marker,collapsed.from==null);if(collapsed.to==null)return collapsed.marker.find();}
@@ -591,7 +612,8 @@
break;}
at-=sz;}},maybeSpill:function(){if(this.children.length<=10)return;var me=this;do{var spilled=me.children.splice(me.children.length-5,5);var sibling=new BranchChunk(spilled);if(!me.parent){var copy=new BranchChunk(me.children);copy.parent=me;me.children=[copy,sibling];me=copy;}else{me.size-=sibling.size;me.height-=sibling.height;var myIndex=indexOf(me.parent.children,me);me.parent.children.splice(myIndex+1,0,sibling);}
sibling.parent=me.parent;}while(me.children.length>10);me.parent.maybeSpill();},iterN:function(at,n,op){for(var i=0,e=this.children.length;i<e;++i){var child=this.children[i],sz=child.chunkSize();if(at<sz){var used=Math.min(n,sz-at);if(child.iterN(at,used,op))return true;if((n-=used)==0)break;at=0;}else at-=sz;}}};var nextDocId=0;var Doc=CodeMirror.Doc=function(text,mode,firstLine){if(!(this instanceof Doc))return new Doc(text,mode,firstLine);if(firstLine==null)firstLine=0;BranchChunk.call(this,[new LeafChunk([new Line("",null)])]);this.first=firstLine;this.scrollTop=this.scrollLeft=0;this.cantEdit=false;this.history=makeHistory();this.cleanGeneration=1;this.frontier=firstLine;var start=Pos(firstLine,0);this.sel={from:start,to:start,head:start,anchor:start,shift:false,extend:false,goalColumn:null};this.id=++nextDocId;this.modeOption=mode;if(typeof text=="string")text=splitLines(text);updateDoc(this,{from:start,to:start,text:text},null,{head:start,anchor:start});};Doc.prototype=createObj(BranchChunk.prototype,{constructor:Doc,iter:function(from,to,op){if(op)this.iterN(from-this.first,to-from,op);else this.iterN(this.first,this.first+this.size,from);},insert:function(at,lines){var height=0;for(var i=0,e=lines.length;i<e;++i)height+=lines[i].height;this.insertInner(at-this.first,lines,height);},remove:function(at,n){this.removeInner(at-this.first,n);},getValue:function(lineSep){var lines=getLines(this,this.first,this.first+this.size);if(lineSep===false)return lines;return lines.join(lineSep||"\n");},setValue:function(code){var top=Pos(this.first,0),last=this.first+this.size-1;makeChange(this,{from:top,to:Pos(last,getLine(this,last).text.length),text:splitLines(code),origin:"setValue"},{head:top,anchor:top},true);},replaceRange:function(code,from,to,origin){from=clipPos(this,from);to=to?clipPos(this,to):from;replaceRange(this,code,from,to,origin);},getRange:function(from,to,lineSep){var lines=getBetween(this,clipPos(this,from),clipPos(this,to));if(lineSep===false)return lines;return lines.join(lineSep||"\n");},getLine:function(line){var l=this.getLineHandle(line);return l&&l.text;},setLine:function(line,text){if(isLine(this,line))
-replaceRange(this,text,Pos(line,0),clipPos(this,Pos(line)));},removeLine:function(line){if(line)replaceRange(this,"",clipPos(this,Pos(line-1)),clipPos(this,Pos(line)));else replaceRange(this,"",Pos(0,0),clipPos(this,Pos(1,0)));},getLineHandle:function(line){if(isLine(this,line))return getLine(this,line);},getLineNumber:function(line){return lineNo(line);},getLineHandleVisualStart:function(line){if(typeof line=="number")line=getLine(this,line);return visualLine(this,line);},lineCount:function(){return this.size;},firstLine:function(){return this.first;},lastLine:function(){return this.first+this.size-1;},clipPos:function(pos){return clipPos(this,pos);},getCursor:function(start){var sel=this.sel,pos;if(start==null||start=="head")pos=sel.head;else if(start=="anchor")pos=sel.anchor;else if(start=="end"||start===false)pos=sel.to;else pos=sel.from;return copyPos(pos);},somethingSelected:function(){return!posEq(this.sel.head,this.sel.anchor);},setCursor:docOperation(function(line,ch,extend){var pos=clipPos(this,typeof line=="number"?Pos(line,ch||0):line);if(extend)extendSelection(this,pos);else setSelection(this,pos,pos);}),setSelection:docOperation(function(anchor,head,bias){setSelection(this,clipPos(this,anchor),clipPos(this,head||anchor),bias);}),extendSelection:docOperation(function(from,to,bias){extendSelection(this,clipPos(this,from),to&&clipPos(this,to),bias);}),getSelection:function(lineSep){return this.getRange(this.sel.from,this.sel.to,lineSep);},replaceSelection:function(code,collapse,origin){makeChange(this,{from:this.sel.from,to:this.sel.to,text:splitLines(code),origin:origin},collapse||"around");},undo:docOperation(function(){makeChangeFromHistory(this,"undo");}),redo:docOperation(function(){makeChangeFromHistory(this,"redo");}),setExtending:function(val){this.sel.extend=val;},historySize:function(){var hist=this.history;return{undo:hist.done.length,redo:hist.undone.length};},clearHistory:function(){this.history=makeHistory(this.history.maxGeneration);},markClean:function(){this.cleanGeneration=this.changeGeneration();},changeGeneration:function(){this.history.lastOp=this.history.lastOrigin=null;return this.history.generation;},isClean:function(gen){return this.history.generation==(gen||this.cleanGeneration);},getHistory:function(){return{done:copyHistoryArray(this.history.done),undone:copyHistoryArray(this.history.undone)};},setHistory:function(histData){var hist=this.history=makeHistory(this.history.maxGeneration);hist.done=histData.done.slice(0);hist.undone=histData.undone.slice(0);},markText:function(from,to,options){return markText(this,clipPos(this,from),clipPos(this,to),options,"range");},setBookmark:function(pos,options){var realOpts={replacedWith:options&&(options.nodeType==null?options.widget:options),insertLeft:options&&options.insertLeft};pos=clipPos(this,pos);return markText(this,pos,pos,realOpts,"bookmark");},findMarksAt:function(pos){pos=clipPos(this,pos);var markers=[],spans=getLine(this,pos.line).markedSpans;if(spans)for(var i=0;i<spans.length;++i){var span=spans[i];if((span.from==null||span.from<=pos.ch)&&(span.to==null||span.to>=pos.ch))
+replaceRange(this,text,Pos(line,0),clipPos(this,Pos(line)));},removeLine:function(line){if(line)replaceRange(this,"",clipPos(this,Pos(line-1)),clipPos(this,Pos(line)));else replaceRange(this,"",Pos(0,0),clipPos(this,Pos(1,0)));},getLineHandle:function(line){if(isLine(this,line))return getLine(this,line);},getLineNumber:function(line){return lineNo(line);},getLineHandleVisualStart:function(line){if(typeof line=="number")line=getLine(this,line);return visualLine(this,line);},lineCount:function(){return this.size;},firstLine:function(){return this.first;},lastLine:function(){return this.first+this.size-1;},clipPos:function(pos){return clipPos(this,pos);},getCursor:function(start){var sel=this.sel,pos;if(start==null||start=="head")pos=sel.head;else if(start=="anchor")pos=sel.anchor;else if(start=="end"||start===false)pos=sel.to;else pos=sel.from;return copyPos(pos);},somethingSelected:function(){return!posEq(this.sel.head,this.sel.anchor);},setCursor:docOperation(function(line,ch,extend){var pos=clipPos(this,typeof line=="number"?Pos(line,ch||0):line);if(extend)extendSelection(this,pos);else setSelection(this,pos,pos);}),setSelection:docOperation(function(anchor,head,bias){setSelection(this,clipPos(this,anchor),clipPos(this,head||anchor),bias);}),extendSelection:docOperation(function(from,to,bias){extendSelection(this,clipPos(this,from),to&&clipPos(this,to),bias);}),getSelection:function(lineSep){return this.getRange(this.sel.from,this.sel.to,lineSep);},replaceSelection:function(code,collapse,origin){makeChange(this,{from:this.sel.from,to:this.sel.to,text:splitLines(code),origin:origin},collapse||"around");},undo:docOperation(function(){makeChangeFromHistory(this,"undo");}),redo:docOperation(function(){makeChangeFromHistory(this,"redo");}),setExtending:function(val){this.sel.extend=val;},historySize:function(){var hist=this.history;return{undo:hist.done.length,redo:hist.undone.length};},clearHistory:function(){this.history=makeHistory(this.history.maxGeneration);},markClean:function(){this.cleanGeneration=this.changeGeneration(true);},changeGeneration:function(forceSplit){if(forceSplit)
+this.history.lastOp=this.history.lastOrigin=null;return this.history.generation;},isClean:function(gen){return this.history.generation==(gen||this.cleanGeneration);},getHistory:function(){return{done:copyHistoryArray(this.history.done),undone:copyHistoryArray(this.history.undone)};},setHistory:function(histData){var hist=this.history=makeHistory(this.history.maxGeneration);hist.done=histData.done.slice(0);hist.undone=histData.undone.slice(0);},markText:function(from,to,options){return markText(this,clipPos(this,from),clipPos(this,to),options,"range");},setBookmark:function(pos,options){var realOpts={replacedWith:options&&(options.nodeType==null?options.widget:options),insertLeft:options&&options.insertLeft,clearWhenEmpty:false};pos=clipPos(this,pos);return markText(this,pos,pos,realOpts,"bookmark");},findMarksAt:function(pos){pos=clipPos(this,pos);var markers=[],spans=getLine(this,pos.line).markedSpans;if(spans)for(var i=0;i<spans.length;++i){var span=spans[i];if((span.from==null||span.from<=pos.ch)&&(span.to==null||span.to>=pos.ch))
markers.push(span.marker.parent||span.marker);}
return markers;},getAllMarks:function(){var markers=[];this.iter(function(line){var sps=line.markedSpans;if(sps)for(var i=0;i<sps.length;++i)
if(sps[i].from!=null)markers.push(sps[i].marker);});return markers;},posFromIndex:function(off){var ch,lineNo=this.first;this.iter(function(line){var sz=line.text.length+1;if(sz>off){ch=off;return true;}
@@ -622,9 +644,9 @@
(existing||(existing=change["spans_"+doc.id]={}))[n]=line.markedSpans;++n;});}
function historyChangeFromChange(doc,change){var from={line:change.from.line,ch:change.from.ch};var histChange={from:from,to:changeEnd(change),text:getBetween(doc,change.from,change.to)};attachLocalSpans(doc,histChange,change.from.line,change.to.line+1);linkedDocs(doc,function(doc){attachLocalSpans(doc,histChange,change.from.line,change.to.line+1);},true);return histChange;}
function addToHistory(doc,change,selAfter,opId){var hist=doc.history;hist.undone.length=0;var time=+new Date,cur=lst(hist.done);if(cur&&(hist.lastOp==opId||hist.lastOrigin==change.origin&&change.origin&&((change.origin.charAt(0)=="+"&&doc.cm&&hist.lastTime>time-doc.cm.options.historyEventDelay)||change.origin.charAt(0)=="*"))){var last=lst(cur.changes);if(posEq(change.from,change.to)&&posEq(change.from,last.to)){last.to=changeEnd(change);}else{cur.changes.push(historyChangeFromChange(doc,change));}
-cur.anchorAfter=selAfter.anchor;cur.headAfter=selAfter.head;}else{cur={changes:[historyChangeFromChange(doc,change)],generation:hist.generation,anchorBefore:doc.sel.anchor,headBefore:doc.sel.head,anchorAfter:selAfter.anchor,headAfter:selAfter.head};hist.done.push(cur);hist.generation=++hist.maxGeneration;while(hist.done.length>hist.undoDepth)
+cur.anchorAfter=selAfter.anchor;cur.headAfter=selAfter.head;}else{cur={changes:[historyChangeFromChange(doc,change)],generation:hist.generation,anchorBefore:doc.sel.anchor,headBefore:doc.sel.head,anchorAfter:selAfter.anchor,headAfter:selAfter.head};hist.done.push(cur);while(hist.done.length>hist.undoDepth)
hist.done.shift();}
-hist.lastTime=time;hist.lastOp=opId;hist.lastOrigin=change.origin;}
+hist.generation=++hist.maxGeneration;hist.lastTime=time;hist.lastOp=opId;hist.lastOrigin=change.origin;}
function removeClearedSpans(spans){if(!spans)return null;for(var i=0,out;i<spans.length;++i){if(spans[i].marker.explicitlyCleared){if(!out)out=spans.slice(0,i);}
else if(out)out.push(spans[i]);}
return!out?spans:out.length?out:null;}
@@ -680,7 +702,8 @@
function bind(f){var args=Array.prototype.slice.call(arguments,1);return function(){return f.apply(null,args);};}
var nonASCIISingleCaseWordChar=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function isWordChar(ch){return/\w/.test(ch)||ch>"\x80"&&(ch.toUpperCase()!=ch.toLowerCase()||nonASCIISingleCaseWordChar.test(ch));}
function isEmpty(obj){for(var n in obj)if(obj.hasOwnProperty(n)&&obj[n])return false;return true;}
-var isExtendingChar=/[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\u1DC0โ€“\u1DFF\u20D0โ€“\u20FF\uA670-\uA672\uA674-\uA67D\uA69F\udc00-\udfff\uFE20โ€“\uFE2F]/;function elt(tag,content,className,style){var e=document.createElement(tag);if(className)e.className=className;if(style)e.style.cssText=style;if(typeof content=="string")setTextContent(e,content);else if(content)for(var i=0;i<content.length;++i)e.appendChild(content[i]);return e;}
+var extendingChars=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function isExtendingChar(ch){return ch.charCodeAt(0)>=768&&extendingChars.test(ch);}
+function elt(tag,content,className,style){var e=document.createElement(tag);if(className)e.className=className;if(style)e.style.cssText=style;if(typeof content=="string")setTextContent(e,content);else if(content)for(var i=0;i<content.length;++i)e.appendChild(content[i]);return e;}
function removeChildren(e){for(var count=e.childNodes.length;count>0;--count)
e.removeChild(e.firstChild);return e;}
function removeChildrenAndAdd(parent,e){return removeChildren(parent).appendChild(e);}
@@ -692,7 +715,7 @@
spanAffectsWrapping=function(str,i){return/\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(str.slice(i-1,i+1));};else if(webkit&&/Chrome\/(?:29|[3-9]\d|\d\d\d)\./.test(navigator.userAgent))
spanAffectsWrapping=function(str,i){var code=str.charCodeAt(i-1);return code>=8208&&code<=8212;};else if(webkit)
spanAffectsWrapping=function(str,i){if(i>1&&str.charCodeAt(i-1)==45){if(/\w/.test(str.charAt(i-2))&&/[^\-?\.]/.test(str.charAt(i)))return true;if(i>2&&/[\d\.,]/.test(str.charAt(i-2))&&/[\d\.,]/.test(str.charAt(i)))return false;}
-return/[~!#%&*)=+}\]\\|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|โ€ฆ[\w~`@#$%\^&*(_=+{[><]/.test(str.slice(i-1,i+1));};var knownScrollbarWidth;function scrollbarWidth(measure){if(knownScrollbarWidth!=null)return knownScrollbarWidth;var test=elt("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");removeChildrenAndAdd(measure,test);if(test.offsetWidth)
+return/[~!#%&*)=+}\]\\|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|\u2026[\w~`@#$%\^&*(_=+{[><]/.test(str.slice(i-1,i+1));};var knownScrollbarWidth;function scrollbarWidth(measure){if(knownScrollbarWidth!=null)return knownScrollbarWidth;var test=elt("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");removeChildrenAndAdd(measure,test);if(test.offsetWidth)
knownScrollbarWidth=test.offsetHeight-test.clientHeight;return knownScrollbarWidth||0;}
var zwspSupported;function zeroWidthElement(measure){if(zwspSupported==null){var test=elt("span","\u200b");removeChildrenAndAdd(measure,elt("span",[test,document.createTextNode("x")]));if(measure.firstChild.offsetHeight!=0)
zwspSupported=test.offsetWidth<=1&&test.offsetHeight>2&&!ie_lt8;}
@@ -701,7 +724,7 @@
return result;}:function(string){return string.split(/\r\n?|\n/);};CodeMirror.splitLines=splitLines;var hasSelection=window.getSelection?function(te){try{return te.selectionStart!=te.selectionEnd;}
catch(e){return false;}}:function(te){try{var range=te.ownerDocument.selection.createRange();}
catch(e){}
-if(!range||range.parentElement()!=te)return false;return range.compareEndPoints("StartToEnd",range)!=0;};var hasCopyEvent=(function(){var e=elt("div");if("oncopy"in e)return true;e.setAttribute("oncopy","return;");return typeof e.oncopy=='function';})();var keyNames={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};CodeMirror.keyNames=keyNames;(function(){for(var i=0;i<10;i++)keyNames[i+48]=String(i);for(var i=65;i<=90;i++)keyNames[i]=String.fromCharCode(i);for(var i=1;i<=12;i++)keyNames[i+111]=keyNames[i+63235]="F"+i;})();function iterateBidiSections(order,from,to,f){if(!order)return f(from,to,"ltr");var found=false;for(var i=0;i<order.length;++i){var part=order[i];if(part.from<to&&part.to>from||from==to&&part.to==from){f(Math.max(part.from,from),Math.min(part.to,to),part.level==1?"rtl":"ltr");found=true;}}
+if(!range||range.parentElement()!=te)return false;return range.compareEndPoints("StartToEnd",range)!=0;};var hasCopyEvent=(function(){var e=elt("div");if("oncopy"in e)return true;e.setAttribute("oncopy","return;");return typeof e.oncopy=='function';})();var keyNames={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};CodeMirror.keyNames=keyNames;(function(){for(var i=0;i<10;i++)keyNames[i+48]=keyNames[i+96]=String(i);for(var i=65;i<=90;i++)keyNames[i]=String.fromCharCode(i);for(var i=1;i<=12;i++)keyNames[i+111]=keyNames[i+63235]="F"+i;})();function iterateBidiSections(order,from,to,f){if(!order)return f(from,to,"ltr");var found=false;for(var i=0;i<order.length;++i){var part=order[i];if(part.from<to&&part.to>from||from==to&&part.to==from){f(Math.max(part.from,from),Math.min(part.to,to),part.level==1?"rtl":"ltr");found=true;}}
if(!found)f(from,to,"ltr");}
function bidiLeft(part){return part.level%2?part.to:part.from;}
function bidiRight(part){return part.level%2?part.from:part.to;}
@@ -711,24 +734,23 @@
function lineEnd(cm,lineN){var merged,line;while(merged=collapsedSpanAtEnd(line=getLine(cm.doc,lineN)))
lineN=merged.find().to.line;var order=getOrder(line);var ch=!order?line.text.length:order[0].level%2?lineLeft(line):lineRight(line);return Pos(lineN,ch);}
function compareBidiLevel(order,a,b){var linedir=order[0].level;if(a==linedir)return true;if(b==linedir)return false;return a<b;}
-var bidiOther;function getBidiPartAt(order,pos){for(var i=0,found;i<order.length;++i){var cur=order[i];if(cur.from<pos&&cur.to>pos){bidiOther=null;return i;}
-if(cur.from==pos||cur.to==pos){if(found==null){found=i;}else if(compareBidiLevel(order,cur.level,order[found].level)){bidiOther=found;return i;}else{bidiOther=i;return found;}}}
-bidiOther=null;return found;}
-function moveInLine(line,pos,dir,byUnit){if(!byUnit)return pos+dir;do pos+=dir;while(pos>0&&isExtendingChar.test(line.text.charAt(pos)));return pos;}
+var bidiOther;function getBidiPartAt(order,pos){bidiOther=null;for(var i=0,found;i<order.length;++i){var cur=order[i];if(cur.from<pos&&cur.to>pos)return i;if((cur.from==pos||cur.to==pos)){if(found==null){found=i;}else if(compareBidiLevel(order,cur.level,order[found].level)){if(cur.from!=cur.to)bidiOther=found;return i;}else{if(cur.from!=cur.to)bidiOther=i;return found;}}}
+return found;}
+function moveInLine(line,pos,dir,byUnit){if(!byUnit)return pos+dir;do pos+=dir;while(pos>0&&isExtendingChar(line.text.charAt(pos)));return pos;}
function moveVisually(line,start,dir,byUnit){var bidi=getOrder(line);if(!bidi)return moveLogically(line,start,dir,byUnit);var pos=getBidiPartAt(bidi,start),part=bidi[pos];var target=moveInLine(line,start,part.level%2?-dir:dir,byUnit);for(;;){if(target>part.from&&target<part.to)return target;if(target==part.from||target==part.to){if(getBidiPartAt(bidi,target)==pos)return target;part=bidi[pos+=dir];return(dir>0)==part.level%2?part.to:part.from;}else{part=bidi[pos+=dir];if(!part)return null;if((dir>0)==part.level%2)
target=moveInLine(line,part.to,-1,byUnit);else
target=moveInLine(line,part.from,1,byUnit);}}}
-function moveLogically(line,start,dir,byUnit){var target=start+dir;if(byUnit)while(target>0&&isExtendingChar.test(line.text.charAt(target)))target+=dir;return target<0||target>line.text.length?null:target;}
+function moveLogically(line,start,dir,byUnit){var target=start+dir;if(byUnit)while(target>0&&isExtendingChar(line.text.charAt(target)))target+=dir;return target<0||target>line.text.length?null:target;}
var bidiOrdering=(function(){var lowTypes="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL";var arabicTypes="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr";function charType(code){if(code<=0xff)return lowTypes.charAt(code);else if(0x590<=code&&code<=0x5f4)return"R";else if(0x600<=code&&code<=0x6ff)return arabicTypes.charAt(code-0x600);else if(0x700<=code&&code<=0x8ac)return"r";else return"L";}
var bidiRE=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;var isNeutral=/[stwN]/,isStrong=/[LRr]/,countsAsLeft=/[Lb1n]/,countsAsNum=/[1n]/;var outerType="L";return function(str){if(!bidiRE.test(str))return false;var len=str.length,types=[];for(var i=0,type;i<len;++i)
types.push(type=charType(str.charCodeAt(i)));for(var i=0,prev=outerType;i<len;++i){var type=types[i];if(type=="m")types[i]=prev;else prev=type;}
for(var i=0,cur=outerType;i<len;++i){var type=types[i];if(type=="1"&&cur=="r")types[i]="n";else if(isStrong.test(type)){cur=type;if(type=="r")types[i]="R";}}
for(var i=1,prev=types[0];i<len-1;++i){var type=types[i];if(type=="+"&&prev=="1"&&types[i+1]=="1")types[i]="1";else if(type==","&&prev==types[i+1]&&(prev=="1"||prev=="n"))types[i]=prev;prev=type;}
for(var i=0;i<len;++i){var type=types[i];if(type==",")types[i]="N";else if(type=="%"){for(var end=i+1;end<len&&types[end]=="%";++end){}
-var replace=(i&&types[i-1]=="!")||(end<len-1&&types[end]=="1")?"1":"N";for(var j=i;j<end;++j)types[j]=replace;i=end-1;}}
+var replace=(i&&types[i-1]=="!")||(end<len&&types[end]=="1")?"1":"N";for(var j=i;j<end;++j)types[j]=replace;i=end-1;}}
for(var i=0,cur=outerType;i<len;++i){var type=types[i];if(cur=="L"&&type=="1")types[i]="L";else if(isStrong.test(type))cur=type;}
for(var i=0;i<len;++i){if(isNeutral.test(types[i])){for(var end=i+1;end<len&&isNeutral.test(types[end]);++end){}
-var before=(i?types[i-1]:outerType)=="L";var after=(end<len-1?types[end]:outerType)=="L";var replace=before||after?"L":"R";for(var j=i;j<end;++j)types[j]=replace;i=end-1;}}
+var before=(i?types[i-1]:outerType)=="L";var after=(end<len?types[end]:outerType)=="L";var replace=before||after?"L":"R";for(var j=i;j<end;++j)types[j]=replace;i=end-1;}}
var order=[],m;for(var i=0;i<len;){if(countsAsLeft.test(types[i])){var start=i;for(++i;i<len&&countsAsLeft.test(types[i]);++i){}
order.push({from:start,to:i,level:0});}else{var pos=i,at=order.length;for(++i;i<len&&types[i]!="L";++i){}
for(var j=pos;j<i;){if(countsAsNum.test(types[j])){if(pos<j)order.splice(at,0,{from:pos,to:j,level:1});var nstart=j;for(++j;j<i&&countsAsNum.test(types[j]);++j){}
@@ -737,7 +759,7 @@
if(order[0].level==1&&(m=str.match(/^\s+/))){order[0].from=m[0].length;order.unshift({from:0,to:m[0].length,level:0});}
if(lst(order).level==1&&(m=str.match(/\s+$/))){lst(order).to-=m[0].length;order.push({from:len-m[0].length,to:len,level:0});}
if(order[0].level!=lst(order).level)
-order.push({from:len,to:len,level:order[0].level});return order;};})();CodeMirror.version="3.20.0";return CodeMirror;})();;CodeMirror.defineMode("css",function(config,parserConfig){"use strict";if(!parserConfig.propertyKeywords)parserConfig=CodeMirror.resolveMode("text/css");var indentUnit=config.indentUnit||config.tabSize||2,hooks=parserConfig.hooks||{},atMediaTypes=parserConfig.atMediaTypes||{},atMediaFeatures=parserConfig.atMediaFeatures||{},propertyKeywords=parserConfig.propertyKeywords||{},colorKeywords=parserConfig.colorKeywords||{},valueKeywords=parserConfig.valueKeywords||{},allowNested=!!parserConfig.allowNested,type=null;function ret(style,tp){type=tp;return style;}
+order.push({from:len,to:len,level:order[0].level});return order;};})();CodeMirror.version="3.21.1";return CodeMirror;})();;CodeMirror.defineMode("css",function(config,parserConfig){"use strict";if(!parserConfig.propertyKeywords)parserConfig=CodeMirror.resolveMode("text/css");var indentUnit=config.indentUnit||config.tabSize||2,hooks=parserConfig.hooks||{},atMediaTypes=parserConfig.atMediaTypes||{},atMediaFeatures=parserConfig.atMediaFeatures||{},propertyKeywords=parserConfig.propertyKeywords||{},colorKeywords=parserConfig.colorKeywords||{},valueKeywords=parserConfig.valueKeywords||{},allowNested=!!parserConfig.allowNested,type=null;function ret(style,tp){type=tp;return style;}
function tokenBase(stream,state){var ch=stream.next();if(hooks[ch]){var result=hooks[ch](stream,state);if(result!==false)return result;}
if(ch=="@"){stream.eatWhile(/[\w\\\-]/);return ret("def",stream.current());}
else if(ch=="=")ret(null,"compare");else if((ch=="~"||ch=="|")&&stream.eat("="))return ret(null,"compare");else if(ch=="\""||ch=="'"){state.tokenize=tokenString(ch);return state.tokenize(stream,state);}
@@ -1154,29 +1176,31 @@
if(end||!escaped){state.tokens.shift();}
return(quote==='`'||quote===')'?'quote':'string');};};var tokenDollar=function(stream,state){if(state.tokens.length>1)stream.eat('$');var ch=stream.next(),hungry=/\w/;if(ch==='{')hungry=/[^}]/;if(ch==='('){state.tokens[0]=tokenString(')');return tokenize(stream,state);}
if(!/\d/.test(ch)){stream.eatWhile(hungry);stream.eat('}');}
-state.tokens.shift();return'def';};function tokenize(stream,state){return(state.tokens[0]||tokenBase)(stream,state);};return{startState:function(){return{tokens:[]};},token:function(stream,state){if(stream.eatSpace())return null;return tokenize(stream,state);}};});CodeMirror.defineMIME('text/x-sh','shell');;WebInspector.CodeMirrorUtils={createTokenizer:function(mimeType)
+state.tokens.shift();return'def';};function tokenize(stream,state){return(state.tokens[0]||tokenBase)(stream,state);};return{startState:function(){return{tokens:[]};},token:function(stream,state){if(stream.eatSpace())return null;return tokenize(stream,state);}};});CodeMirror.defineMIME('text/x-sh','shell');;WebInspector.CodeMirrorUtils=function()
+{WebInspector.InplaceEditor.call(this);}
+WebInspector.CodeMirrorUtils.prototype={editorContent:function(editingContext){return editingContext.codeMirror.getValue();},_consumeCopy:function(e)
+{e.consume();},setUpEditor:function(editingContext)
+{var element=editingContext.element;var config=editingContext.config;loadScript("CodeMirrorTextEditor.js");editingContext.cssLoadView=new WebInspector.CodeMirrorCSSLoadView();editingContext.cssLoadView.show(element);WebInspector.setCurrentFocusElement(element);element.addEventListener("copy",this._consumeCopy,false);var codeMirror=window.CodeMirror(element,{mode:config.mode,lineWrapping:config.lineWrapping,smartIndent:config.smartIndent,autofocus:true,theme:config.theme,value:config.initialValue});codeMirror.getWrapperElement().classList.add("source-code");codeMirror.on("cursorActivity",function(cm){cm.display.cursor.scrollIntoViewIfNeeded(false);});editingContext.codeMirror=codeMirror;},closeEditor:function(editingContext)
+{editingContext.element.removeEventListener("copy",this._consumeCopy,false);editingContext.cssLoadView.detach();},cancelEditing:function(editingContext)
+{editingContext.codeMirror.setValue(editingContext.oldText);},augmentEditingHandle:function(editingContext,handle)
+{function setWidth(editingContext,width)
+{var padding=30;var codeMirror=editingContext.codeMirror;codeMirror.getWrapperElement().style.width=(width-codeMirror.getWrapperElement().offsetLeft-padding)+"px";codeMirror.refresh();}
+handle.codeMirror=editingContext.codeMirror;handle.setWidth=setWidth.bind(null,editingContext);},__proto__:WebInspector.InplaceEditor.prototype}
+WebInspector.CodeMirrorUtils.TokenizerFactory=function(){}
+WebInspector.CodeMirrorUtils.TokenizerFactory.prototype={createTokenizer:function(mimeType)
{var mode=CodeMirror.getMode({indentUnit:2},mimeType);var state=CodeMirror.startState(mode);function tokenize(line,callback)
{var stream=new CodeMirror.StringStream(line);while(!stream.eol()){var style=mode.token(stream,state);var value=stream.current();callback(value,style,stream.start,stream.start+value.length);stream.start=stream.pos;}}
-return tokenize;},convertTokenType:function(tokenType)
-{if(tokenType.startsWith("js-variable")||tokenType.startsWith("js-property")||tokenType==="js-def")
-return"javascript-ident";if(tokenType==="js-string-2")
-return"javascript-regexp";if(tokenType==="js-number"||tokenType==="js-comment"||tokenType==="js-string"||tokenType==="js-keyword")
-return"javascript-"+tokenType.substring("js-".length);if(tokenType==="css-number")
-return"css-number";return null;},overrideModeWithPrefixedTokens:function(modeName,tokenPrefix)
-{var oldModeName=modeName+"-old";if(CodeMirror.modes[oldModeName])
-return;CodeMirror.defineMode(oldModeName,CodeMirror.modes[modeName]);CodeMirror.defineMode(modeName,modeConstructor);function modeConstructor(config,parserConfig)
-{var innerConfig={};for(var i in parserConfig)
-innerConfig[i]=parserConfig[i];innerConfig.name=oldModeName;var codeMirrorMode=CodeMirror.getMode(config,innerConfig);codeMirrorMode.name=modeName;codeMirrorMode.token=tokenOverride.bind(null,codeMirrorMode.token);return codeMirrorMode;}
-function tokenOverride(superToken,stream,state)
-{var token=superToken(stream,state);return token?tokenPrefix+token:token;}}}
-WebInspector.CodeMirrorUtils.overrideModeWithPrefixedTokens("css","css-");WebInspector.CodeMirrorUtils.overrideModeWithPrefixedTokens("javascript","js-");WebInspector.CodeMirrorUtils.overrideModeWithPrefixedTokens("xml","xml-");;WebInspector.CodeMirrorTextEditor=function(url,delegate)
-{WebInspector.View.call(this);this._delegate=delegate;this._url=url;this.registerRequiredCSS("cm/codemirror.css");this.registerRequiredCSS("cm/cmdevtools.css");this._codeMirror=window.CodeMirror(this.element,{lineNumbers:true,gutters:["CodeMirror-linenumbers"],matchBrackets:true,smartIndent:false,styleSelectedText:true,electricChars:false,});this._codeMirror._codeMirrorTextEditor=this;CodeMirror.keyMap["devtools-common"]={"Left":"goCharLeft","Right":"goCharRight","Up":"goLineUp","Down":"goLineDown","End":"goLineEnd","Home":"goLineStartSmart","PageUp":"goPageUp","PageDown":"goPageDown","Delete":"delCharAfter","Backspace":"delCharBefore","Tab":"defaultTab","Shift-Tab":"indentLess","Enter":"smartNewlineAndIndent","Ctrl-Space":"autocomplete"};CodeMirror.keyMap["devtools-pc"]={"Ctrl-A":"selectAll","Ctrl-Z":"undoAndReveal","Shift-Ctrl-Z":"redoAndReveal","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-/":"toggleComment",fallthrough:"devtools-common"};CodeMirror.keyMap["devtools-mac"]={"Cmd-A":"selectAll","Cmd-Z":"undoAndReveal","Shift-Cmd-Z":"redoAndReveal","Cmd-Up":"goDocStart","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStartSmart","Cmd-Right":"goLineEnd","Alt-Backspace":"delGroupBefore","Alt-Delete":"delGroupAfter","Cmd-/":"toggleComment",fallthrough:"devtools-common"};WebInspector.settings.textEditorIndent.addChangeListener(this._updateEditorIndentation,this);this._updateEditorIndentation();WebInspector.settings.showWhitespacesInEditor.addChangeListener(this._updateCodeMirrorMode,this);WebInspector.settings.textEditorBracketMatching.addChangeListener(this._enableBracketMatchingIfNeeded,this);this._enableBracketMatchingIfNeeded();this._codeMirror.setOption("keyMap",WebInspector.isMac()?"devtools-mac":"devtools-pc");this._codeMirror.setOption("flattenSpans",false);this._codeMirror.setOption("maxHighlightLength",WebInspector.CodeMirrorTextEditor.maxHighlightLength);this._codeMirror.setOption("mode",null);this._codeMirror.setOption("crudeMeasuringFrom",1000);this._shouldClearHistory=true;this._lineSeparator="\n";this._tokenHighlighter=new WebInspector.CodeMirrorTextEditor.TokenHighlighter(this._codeMirror);this._blockIndentController=new WebInspector.CodeMirrorTextEditor.BlockIndentController(this._codeMirror);this._fixWordMovement=new WebInspector.CodeMirrorTextEditor.FixWordMovement(this._codeMirror);this._autocompleteController=new WebInspector.CodeMirrorTextEditor.AutocompleteController(this,this._codeMirror);this._codeMirror.on("change",this._change.bind(this));this._codeMirror.on("beforeChange",this._beforeChange.bind(this));this._codeMirror.on("gutterClick",this._gutterClick.bind(this));this._codeMirror.on("cursorActivity",this._cursorActivity.bind(this));this._codeMirror.on("beforeSelectionChange",this._beforeSelectionChange.bind(this));this._codeMirror.on("scroll",this._scroll.bind(this));this._codeMirror.on("focus",this._focus.bind(this));this._codeMirror.on("blur",this._blur.bind(this));this.element.addEventListener("contextmenu",this._contextMenu.bind(this),false);function updateAnticipateJumpFlag(value)
+return tokenize;}}
+WebInspector.CodeMirrorCSSLoadView=function()
+{WebInspector.VBox.call(this);this.element.classList.add("hidden");this.registerRequiredCSS("cm/codemirror.css");this.registerRequiredCSS("cm/cmdevtools.css");}
+WebInspector.CodeMirrorCSSLoadView.prototype={__proto__:WebInspector.VBox.prototype};WebInspector.CodeMirrorTextEditor=function(url,delegate)
+{WebInspector.VBox.call(this);this._delegate=delegate;this._url=url;this.registerRequiredCSS("cm/codemirror.css");this.registerRequiredCSS("cm/cmdevtools.css");this._codeMirror=window.CodeMirror(this.element,{lineNumbers:true,gutters:["CodeMirror-linenumbers"],matchBrackets:true,smartIndent:false,styleSelectedText:true,electricChars:false,});this._codeMirror._codeMirrorTextEditor=this;CodeMirror.keyMap["devtools-common"]={"Left":"goCharLeft","Right":"goCharRight","Up":"goLineUp","Down":"goLineDown","End":"goLineEnd","Home":"goLineStartSmart","PageUp":"goPageUp","PageDown":"goPageDown","Delete":"delCharAfter","Backspace":"delCharBefore","Tab":"defaultTab","Shift-Tab":"indentLess","Enter":"smartNewlineAndIndent","Ctrl-Space":"autocomplete"};CodeMirror.keyMap["devtools-pc"]={"Ctrl-A":"selectAll","Ctrl-Z":"undoAndReveal","Shift-Ctrl-Z":"redoAndReveal","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-/":"toggleComment",fallthrough:"devtools-common"};CodeMirror.keyMap["devtools-mac"]={"Cmd-A":"selectAll","Cmd-Z":"undoAndReveal","Shift-Cmd-Z":"redoAndReveal","Cmd-Up":"goDocStart","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStartSmart","Cmd-Right":"goLineEnd","Alt-Backspace":"delGroupBefore","Alt-Delete":"delGroupAfter","Cmd-/":"toggleComment",fallthrough:"devtools-common"};WebInspector.settings.textEditorIndent.addChangeListener(this._updateEditorIndentation,this);this._updateEditorIndentation();WebInspector.settings.showWhitespacesInEditor.addChangeListener(this._updateCodeMirrorMode,this);WebInspector.settings.textEditorBracketMatching.addChangeListener(this._enableBracketMatchingIfNeeded,this);this._enableBracketMatchingIfNeeded();this._codeMirror.setOption("keyMap",WebInspector.isMac()?"devtools-mac":"devtools-pc");this._codeMirror.setOption("flattenSpans",false);this._codeMirror.setOption("maxHighlightLength",WebInspector.CodeMirrorTextEditor.maxHighlightLength);this._codeMirror.setOption("mode",null);this._codeMirror.setOption("crudeMeasuringFrom",1000);this._shouldClearHistory=true;this._lineSeparator="\n";this._tokenHighlighter=new WebInspector.CodeMirrorTextEditor.TokenHighlighter(this._codeMirror);this._blockIndentController=new WebInspector.CodeMirrorTextEditor.BlockIndentController(this._codeMirror);this._fixWordMovement=new WebInspector.CodeMirrorTextEditor.FixWordMovement(this._codeMirror);this._autocompleteController=new WebInspector.CodeMirrorTextEditor.AutocompleteController(this,this._codeMirror);this._codeMirror.on("change",this._change.bind(this));this._codeMirror.on("beforeChange",this._beforeChange.bind(this));this._codeMirror.on("gutterClick",this._gutterClick.bind(this));this._codeMirror.on("cursorActivity",this._cursorActivity.bind(this));this._codeMirror.on("beforeSelectionChange",this._beforeSelectionChange.bind(this));this._codeMirror.on("scroll",this._scroll.bind(this));this._codeMirror.on("focus",this._focus.bind(this));this._codeMirror.on("blur",this._blur.bind(this));this.element.addEventListener("contextmenu",this._contextMenu.bind(this),false);function updateAnticipateJumpFlag(value)
{this._isHandlingMouseDownEvent=value;}
-this.element.addEventListener("mousedown",updateAnticipateJumpFlag.bind(this,true),true);this.element.addEventListener("mousedown",updateAnticipateJumpFlag.bind(this,false),false);this.element.classList.add("fill");this.element.style.overflow="hidden";this.element.firstChild.classList.add("source-code");this.element.firstChild.classList.add("fill");this._elementToWidget=new Map();this._nestedUpdatesCounter=0;this.element.addEventListener("focus",this._handleElementFocus.bind(this),false);this.element.addEventListener("keydown",this._handleKeyDown.bind(this),true);this.element.addEventListener("keydown",this._handlePostKeyDown.bind(this),false);this.element.tabIndex=0;this._setupSelectionColor();this._setupWhitespaceHighlight();}
+this.element.addEventListener("mousedown",updateAnticipateJumpFlag.bind(this,true),true);this.element.addEventListener("mousedown",updateAnticipateJumpFlag.bind(this,false),false);this.element.style.overflow="hidden";this.element.firstChild.classList.add("source-code");this.element.firstChild.classList.add("fill");this._elementToWidget=new Map();this._nestedUpdatesCounter=0;this.element.addEventListener("focus",this._handleElementFocus.bind(this),false);this.element.addEventListener("keydown",this._handleKeyDown.bind(this),true);this.element.addEventListener("keydown",this._handlePostKeyDown.bind(this),false);this.element.tabIndex=0;this._setupWhitespaceHighlight();}
WebInspector.CodeMirrorTextEditor.BeforeChangeObject;WebInspector.CodeMirrorTextEditor.ChangeObject;WebInspector.CodeMirrorTextEditor.maxHighlightLength=1000;WebInspector.CodeMirrorTextEditor.autocompleteCommand=function(codeMirror)
{codeMirror._codeMirrorTextEditor._autocompleteController.autocomplete();}
CodeMirror.commands.autocomplete=WebInspector.CodeMirrorTextEditor.autocompleteCommand;CodeMirror.commands.smartNewlineAndIndent=function(codeMirror)
-{codeMirror.operation(innerSmartNewlineAndIndent.bind(this,codeMirror));function countIndent(line)
+{codeMirror.operation(innerSmartNewlineAndIndent.bind(null,codeMirror));function countIndent(line)
{for(var i=0;i<line.length;++i){if(!WebInspector.TextUtils.isSpaceChar(line[i]))
return i;}
return line.length;}
@@ -1184,19 +1208,20 @@
{var cur=codeMirror.getCursor("start");var line=codeMirror.getLine(cur.line);var indent=cur.line>0?countIndent(line):0;if(cur.ch<=indent){codeMirror.replaceSelection("\n"+line.substring(0,cur.ch),"end","+input");codeMirror.setSelection(new CodeMirror.Pos(cur.line+1,cur.ch));}else
codeMirror.execCommand("newlineAndIndent");}}
CodeMirror.commands.undoAndReveal=function(codemirror)
-{var scrollInfo=codemirror.getScrollInfo();codemirror.execCommand("undo");var cursor=codemirror.getCursor("start");codemirror._codeMirrorTextEditor._innerRevealLine(cursor.line,scrollInfo);}
+{var scrollInfo=codemirror.getScrollInfo();codemirror.execCommand("undo");var cursor=codemirror.getCursor("start");codemirror._codeMirrorTextEditor._innerRevealLine(cursor.line,scrollInfo);codemirror._codeMirrorTextEditor._autocompleteController.finishAutocomplete();}
CodeMirror.commands.redoAndReveal=function(codemirror)
-{var scrollInfo=codemirror.getScrollInfo();codemirror.execCommand("redo");var cursor=codemirror.getCursor("start");codemirror._codeMirrorTextEditor._innerRevealLine(cursor.line,scrollInfo);}
-WebInspector.CodeMirrorTextEditor.LongLineModeLineLengthThreshold=2000;WebInspector.CodeMirrorTextEditor.MaximumNumberOfWhitespacesPerSingleSpan=16;WebInspector.CodeMirrorTextEditor.prototype={_enableBracketMatchingIfNeeded:function()
+{var scrollInfo=codemirror.getScrollInfo();codemirror.execCommand("redo");var cursor=codemirror.getCursor("start");codemirror._codeMirrorTextEditor._innerRevealLine(cursor.line,scrollInfo);codemirror._codeMirrorTextEditor._autocompleteController.finishAutocomplete();}
+WebInspector.CodeMirrorTextEditor.LongLineModeLineLengthThreshold=2000;WebInspector.CodeMirrorTextEditor.MaximumNumberOfWhitespacesPerSingleSpan=16;WebInspector.CodeMirrorTextEditor.MaxEditableTextSize=1024*1024*10;WebInspector.CodeMirrorTextEditor.prototype={_enableBracketMatchingIfNeeded:function()
{this._codeMirror.setOption("autoCloseBrackets",WebInspector.settings.textEditorBracketMatching.get()?{explode:false}:false);},wasShown:function()
-{this._codeMirror.refresh();},_guessIndentationLevel:function()
+{if(this._wasOnceShown)
+return;this._wasOnceShown=true;this._codeMirror.refresh();},_guessIndentationLevel:function()
{var tabRegex=/^\t+/;var tabLines=0;var indents={};function processLine(lineHandle)
{var text=lineHandle.text;if(text.length===0||!WebInspector.TextUtils.isSpaceChar(text[0]))
return;if(tabRegex.test(text)){++tabLines;return;}
var i=0;while(i<text.length&&WebInspector.TextUtils.isSpaceChar(text[i]))
++i;if(i%2!==0)
return;indents[i]=1+(indents[i]||0);}
-this._codeMirror.eachLine(processLine);var onePercentFilterThreshold=this.linesCount/100;if(tabLines&&tabLines>onePercentFilterThreshold)
+this._codeMirror.eachLine(0,1000,processLine);var onePercentFilterThreshold=this.linesCount/100;if(tabLines&&tabLines>onePercentFilterThreshold)
return"\t";var minimumIndent=Infinity;for(var i in indents){if(indents[i]<onePercentFilterThreshold)
continue;var indent=parseInt(i,10);if(minimumIndent>indent)
minimumIndent=indent;}
@@ -1209,7 +1234,7 @@
this._codeMirror.setOption("extraKeys",extraKeys);this._indentationLevel=indent;},indent:function()
{return this._indentationLevel;},highlightSearchResults:function(regex,range)
{function innerHighlightRegex()
-{if(range){this.revealLine(range.startLine);if(range.endColumn>WebInspector.CodeMirrorTextEditor.maxHighlightLength)
+{if(range){this._revealLine(range.startLine);if(range.endColumn>WebInspector.CodeMirrorTextEditor.maxHighlightLength)
this.setSelection(range);else
this.setSelection(WebInspector.TextRange.createFromLocation(range.startLine,range.startColumn));}else{this.setSelection(this.selection().collapseToEnd());}
this._tokenHighlighter.highlightSearchResults(regex,range);}
@@ -1217,10 +1242,7 @@
this._selectionBeforeSearch=this.selection();this._codeMirror.operation(innerHighlightRegex.bind(this));},cancelSearchResultsHighlight:function()
{this._codeMirror.operation(this._tokenHighlighter.highlightSelectedTokens.bind(this._tokenHighlighter));if(this._selectionBeforeSearch){this._reportJump(this._selectionBeforeSearch,this.selection());delete this._selectionBeforeSearch;}},undo:function()
{this._codeMirror.undo();},redo:function()
-{this._codeMirror.redo();},_setupSelectionColor:function()
-{if(WebInspector.CodeMirrorTextEditor._selectionStyleInjected)
-return;WebInspector.CodeMirrorTextEditor._selectionStyleInjected=true;var backgroundColor=WebInspector.getSelectionBackgroundColor();var backgroundColorRule=backgroundColor?".CodeMirror .CodeMirror-selected { background-color: "+backgroundColor+";}":"";var foregroundColor=WebInspector.getSelectionForegroundColor();var foregroundColorRule=foregroundColor?".CodeMirror .CodeMirror-selectedtext:not(.CodeMirror-persist-highlight) { color: "+foregroundColor+"!important;}":"";if(!foregroundColorRule&&!backgroundColorRule)
-return;var style=document.createElement("style");style.textContent=backgroundColorRule+foregroundColorRule;document.head.appendChild(style);},_setupWhitespaceHighlight:function()
+{this._codeMirror.redo();},_setupWhitespaceHighlight:function()
{if(WebInspector.CodeMirrorTextEditor._whitespaceStyleInjected||!WebInspector.settings.showWhitespacesInEditor.get())
return;WebInspector.CodeMirrorTextEditor._whitespaceStyleInjected=true;const classBase=".show-whitespaces .CodeMirror .cm-whitespace-";const spaceChar="ยท";var spaceChars="";var rules="";for(var i=1;i<=WebInspector.CodeMirrorTextEditor.MaximumNumberOfWhitespacesPerSingleSpan;++i){spaceChars+=spaceChar;var rule=classBase+i+"::before { content: '"+spaceChars+"';}\n";rules+=rule;}
var style=document.createElement("style");style.textContent=rules;document.head.appendChild(style);},_handleKeyDown:function(e)
@@ -1229,9 +1251,11 @@
{if(e.defaultPrevented)
e.consume(true);},_shouldProcessWordForAutocompletion:function(word)
{return word.length&&(word[0]<'0'||word[0]>'9');},_addTextToCompletionDictionary:function(text)
-{var words=WebInspector.TextUtils.textToWords(text);for(var i=0;i<words.length;++i){if(this._shouldProcessWordForAutocompletion(words[i]))
+{if(this.readOnly())
+return;var words=WebInspector.TextUtils.textToWords(text);for(var i=0;i<words.length;++i){if(this._shouldProcessWordForAutocompletion(words[i]))
this._dictionary.addWord(words[i]);}},_removeTextFromCompletionDictionary:function(text)
-{var words=WebInspector.TextUtils.textToWords(text);for(var i=0;i<words.length;++i){if(this._shouldProcessWordForAutocompletion(words[i]))
+{if(this.readOnly())
+return;var words=WebInspector.TextUtils.textToWords(text);for(var i=0;i<words.length;++i){if(this._shouldProcessWordForAutocompletion(words[i]))
this._dictionary.removeWord(words[i]);}},setCompletionDictionary:function(dictionary)
{if(!dictionary){delete this._dictionary;return;}
this._dictionary=dictionary;this._addTextToCompletionDictionary(this.text());},cursorPositionToCoordinates:function(lineNumber,column)
@@ -1242,8 +1266,7 @@
return null;var coords=this._codeMirror.coordsChar({left:x,top:y});return this._toRange(coords,coords);},tokenAtTextPosition:function(lineNumber,column)
{if(lineNumber<0||lineNumber>=this._codeMirror.lineCount())
return null;var token=this._codeMirror.getTokenAt(new CodeMirror.Pos(lineNumber,(column||0)+1));if(!token||!token.type)
-return null;var convertedType=WebInspector.CodeMirrorUtils.convertTokenType(token.type);if(!convertedType)
-return null;return{startColumn:token.start,endColumn:token.end-1,type:convertedType};},copyRange:function(textRange)
+return null;return{startColumn:token.start,endColumn:token.end-1,type:token.type};},copyRange:function(textRange)
{var pos=this._toPos(textRange.normalize());return this._codeMirror.getRange(pos.start,pos.end);},isClean:function()
{return this._codeMirror.isClean();},markClean:function()
{this._codeMirror.markClean();},_hasLongLines:function()
@@ -1262,11 +1285,11 @@
CodeMirror.defineMode(modeName,modeConstructor);return modeName;},_enableLongLinesMode:function()
{this._codeMirror.setOption("styleSelectedText",false);this._longLinesMode=true;},_disableLongLinesMode:function()
{this._codeMirror.setOption("styleSelectedText",true);this._longLinesMode=false;},_updateCodeMirrorMode:function()
-{var showWhitespaces=WebInspector.settings.showWhitespacesInEditor.get();this.element.enableStyleClass("show-whitespaces",showWhitespaces);this._codeMirror.setOption("mode",showWhitespaces?this._whitespaceOverlayMode(this._mimeType):this._mimeType);},setMimeType:function(mimeType)
+{var showWhitespaces=WebInspector.settings.showWhitespacesInEditor.get();this.element.classList.toggle("show-whitespaces",showWhitespaces);this._codeMirror.setOption("mode",showWhitespaces?this._whitespaceOverlayMode(this._mimeType):this._mimeType);},setMimeType:function(mimeType)
{this._mimeType=mimeType;if(this._hasLongLines())
this._enableLongLinesMode();else
this._disableLongLinesMode();this._updateCodeMirrorMode();},setReadOnly:function(readOnly)
-{this.element.enableStyleClass("CodeMirror-readonly",readOnly)
+{this.element.classList.toggle("CodeMirror-readonly",readOnly)
this._codeMirror.setOption("readOnly",readOnly);},readOnly:function()
{return!!this._codeMirror.getOption("readOnly");},removeHighlight:function(highlightDescriptor)
{highlightDescriptor.clear();},highlightRange:function(range,cssClass)
@@ -1276,7 +1299,7 @@
{this._codeMirror.focus();},beginUpdates:function()
{++this._nestedUpdatesCounter;},endUpdates:function()
{if(!--this._nestedUpdatesCounter)
-this._codeMirror.refresh();},revealLine:function(lineNumber)
+this._codeMirror.refresh();},_revealLine:function(lineNumber)
{this._innerRevealLine(lineNumber,this._codeMirror.getScrollInfo());},_innerRevealLine:function(lineNumber,scrollInfo)
{var topLine=this._codeMirror.lineAtHeight(scrollInfo.top,"local");var bottomLine=this._codeMirror.lineAtHeight(scrollInfo.top+scrollInfo.clientHeight,"local");var linesPerScreen=bottomLine-topLine+1;if(lineNumber<topLine){var topLineToReveal=Math.max(lineNumber-(linesPerScreen/2)+1,0)|0;this._codeMirror.scrollIntoView(new CodeMirror.Pos(topLineToReveal,0));}else if(lineNumber>bottomLine){var bottomLineToReveal=Math.min(lineNumber+(linesPerScreen/2)-1,this.linesCount-1)|0;this._codeMirror.scrollIntoView(new CodeMirror.Pos(bottomLineToReveal,0));}},_gutterClick:function(instance,lineNumber,gutter,event)
{this.dispatchEventToListeners(WebInspector.TextEditor.Events.GutterClick,{lineNumber:lineNumber,event:event});},_contextMenu:function(event)
@@ -1289,16 +1312,16 @@
return;var wrapClasses=this._codeMirror.getLineHandle(lineNumber).wrapClass;if(!wrapClasses)
return;var classes=wrapClasses.split(" ");for(var i=0;i<classes.length;++i){if(classes[i].startsWith("cm-breakpoint"))
this._codeMirror.removeLineClass(lineNumber,"wrap",classes[i]);}},setExecutionLine:function(lineNumber)
-{this._executionLine=this._codeMirror.getLineHandle(lineNumber);this._codeMirror.addLineClass(this._executionLine,"wrap","cm-execution-line");},clearExecutionLine:function()
-{if(this._executionLine)
+{this.clearPositionHighlight();this._executionLine=this._codeMirror.getLineHandle(lineNumber);if(!this._executionLine)
+return;this._codeMirror.addLineClass(this._executionLine,"wrap","cm-execution-line");},clearExecutionLine:function()
+{this.clearPositionHighlight();if(this._executionLine)
this._codeMirror.removeLineClass(this._executionLine,"wrap","cm-execution-line");delete this._executionLine;},addDecoration:function(lineNumber,element)
{var widget=this._codeMirror.addLineWidget(lineNumber,element);this._elementToWidget.put(element,widget);},removeDecoration:function(lineNumber,element)
{var widget=this._elementToWidget.remove(element);if(widget)
-this._codeMirror.removeLineWidget(widget);},highlightPosition:function(lineNumber,columnNumber)
-{if(lineNumber<0)
-return;lineNumber=Math.min(lineNumber,this._codeMirror.lineCount()-1);if(typeof columnNumber!=="number"||columnNumber<0||columnNumber>this._codeMirror.getLine(lineNumber).length)
-columnNumber=0;this.clearPositionHighlight();this._highlightedLine=this._codeMirror.getLineHandle(lineNumber);if(!this._highlightedLine)
-return;this.revealLine(lineNumber);this._codeMirror.addLineClass(this._highlightedLine,null,"cm-highlight");this._clearHighlightTimeout=setTimeout(this.clearPositionHighlight.bind(this),2000);if(!this.readOnly())
+this._codeMirror.removeLineWidget(widget);},revealPosition:function(lineNumber,columnNumber,shouldHighlight)
+{lineNumber=Number.constrain(lineNumber,0,this._codeMirror.lineCount()-1);if(typeof columnNumber!=="number")
+columnNumber=0;columnNumber=Number.constrain(columnNumber,0,this._codeMirror.getLine(lineNumber).length);this.clearPositionHighlight();this._highlightedLine=this._codeMirror.getLineHandle(lineNumber);if(!this._highlightedLine)
+return;this._revealLine(lineNumber);if(shouldHighlight){this._codeMirror.addLineClass(this._highlightedLine,null,"cm-highlight");this._clearHighlightTimeout=setTimeout(this.clearPositionHighlight.bind(this),2000);}
this.setSelection(WebInspector.TextRange.createFromLocation(lineNumber,columnNumber));},clearPositionHighlight:function()
{if(this._clearHighlightTimeout)
clearTimeout(this._clearHighlightTimeout);delete this._clearHighlightTimeout;if(this._highlightedLine)
@@ -1309,8 +1332,8 @@
newPaddingBottom=0;else
newPaddingBottom=Math.max(scrollInfo.clientHeight-this._codeMirror.getLineHandle(this._codeMirror.lastLine()).height,0);newPaddingBottom+="px";linesElement.style.paddingBottom=newPaddingBottom;this._codeMirror.setSize(width,height);},_resizeEditor:function()
{var parentElement=this.element.parentElement;if(!parentElement||!this.isShowing())
-return;var scrollInfo=this._codeMirror.getScrollInfo();var width=parentElement.offsetWidth;var height=parentElement.offsetHeight;this._codeMirror.setSize(width,height);this._updatePaddingBottom(width,height);this._codeMirror.scrollTo(scrollInfo.left,scrollInfo.top);},onResize:function()
-{this._resizeEditor();},editRange:function(range,text)
+return;var scrollLeft=this._codeMirror.doc.scrollLeft;var scrollTop=this._codeMirror.doc.scrollTop;var width=parentElement.offsetWidth;var height=parentElement.offsetHeight;this._codeMirror.setSize(width,height);this._updatePaddingBottom(width,height);this._codeMirror.scrollTo(scrollLeft,scrollTop);},onResize:function()
+{this._autocompleteController.finishAutocomplete();this._resizeEditor();},editRange:function(range,text)
{var pos=this._toPos(range);this._codeMirror.replaceRange(text,pos.start,pos.end);var newRange=this._toRange(pos.start,this._codeMirror.posFromIndex(this._codeMirror.indexFromPos(pos.start)+text.length));this._delegate.onTextChanged(range,newRange);if(WebInspector.settings.textEditorAutoDetectIndent.get())
this._updateEditorIndentation();return newRange;},_wordRangeForCursorPosition:function(lineNumber,column,prefixOnly)
{var line=this.line(lineNumber);if(column===0||!WebInspector.TextUtils.isWordChar(line.charAt(column-1)))
@@ -1327,8 +1350,7 @@
this._removeTextFromCompletionDictionary(this._updatedLines[lineNumber]);delete this._updatedLines;}
var linesToUpdate={};var singleCharInput=false;do{var oldRange=this._toRange(changeObject.from,changeObject.to);var newRange=oldRange.clone();var linesAdded=changeObject.text.length;singleCharInput=(changeObject.origin==="+input"&&changeObject.text.length===1&&changeObject.text[0].length===1)||(changeObject.origin==="+delete"&&changeObject.removed.length===1&&changeObject.removed[0].length===1);if(linesAdded===0){newRange.endLine=newRange.startLine;newRange.endColumn=newRange.startColumn;}else if(linesAdded===1){newRange.endLine=newRange.startLine;newRange.endColumn=newRange.startColumn+changeObject.text[0].length;}else{newRange.endLine=newRange.startLine+linesAdded-1;newRange.endColumn=changeObject.text[linesAdded-1].length;}
if(!this._muteTextChangedEvent)
-this._delegate.onTextChanged(oldRange,newRange);for(var i=newRange.startLine;i<=newRange.endLine;++i){linesToUpdate[i]=true;}
-if(this._dictionary){for(var i=newRange.startLine;i<=newRange.endLine;++i)
+this._delegate.onTextChanged(oldRange,newRange);if(this._dictionary){for(var i=newRange.startLine;i<=newRange.endLine;++i)
linesToUpdate[i]=this.line(i);}}while(changeObject=changeObject.next);if(this._dictionary){for(var lineNumber in linesToUpdate)
this._addTextToCompletionDictionary(linesToUpdate[lineNumber]);}
if(singleCharInput)
@@ -1350,7 +1372,9 @@
{return this._lastSelection;},setSelection:function(textRange)
{this._lastSelection=textRange;var pos=this._toPos(textRange);this._codeMirror.setSelection(pos.start,pos.end);},_detectLineSeparator:function(text)
{this._lineSeparator=text.indexOf("\r\n")>=0?"\r\n":"\n";},setText:function(text)
-{this._muteTextChangedEvent=true;this._codeMirror.setValue(text);this._updateEditorIndentation();if(this._shouldClearHistory){this._codeMirror.clearHistory();this._shouldClearHistory=false;}
+{this._muteTextChangedEvent=true;if(text.length>WebInspector.CodeMirrorTextEditor.MaxEditableTextSize){if(this._dictionary)
+this._dictionary.reset();this.setReadOnly(true);}
+this._codeMirror.setValue(text);this._updateEditorIndentation();if(this._shouldClearHistory){this._codeMirror.clearHistory();this._shouldClearHistory=false;}
this._detectLineSeparator(text);delete this._muteTextChangedEvent;},text:function()
{return this._codeMirror.getValue().replace(/\n/g,this._lineSeparator);},range:function()
{var lineCount=this.linesCount;var lastLine=this._codeMirror.getLine(lineCount-1);return this._toRange(new CodeMirror.Pos(0,0),new CodeMirror.Pos(lineCount-1,lastLine.length));},line:function(lineNumber)
@@ -1365,7 +1389,7 @@
delete handle.attributes[name];},_toPos:function(range)
{return{start:new CodeMirror.Pos(range.startLine,range.startColumn),end:new CodeMirror.Pos(range.endLine,range.endColumn)}},_toRange:function(start,end)
{return new WebInspector.TextRange(start.line,start.ch,end.line,end.ch);},textEditorPositionHandle:function(lineNumber,columnNumber)
-{return new WebInspector.CodeMirrorPositionHandle(this._codeMirror,new CodeMirror.Pos(lineNumber,columnNumber));},__proto__:WebInspector.View.prototype}
+{return new WebInspector.CodeMirrorPositionHandle(this._codeMirror,new CodeMirror.Pos(lineNumber,columnNumber));},__proto__:WebInspector.VBox.prototype}
WebInspector.CodeMirrorPositionHandle=function(codeMirror,pos)
{this._codeMirror=codeMirror;this._lineHandle=codeMirror.getLineHandle(pos.line);this._columnNumber=pos.ch;}
WebInspector.CodeMirrorPositionHandle.prototype={resolve:function()
@@ -1424,7 +1448,7 @@
return CodeMirror.Pass;var cursor=codeMirror.getCursor("head");if(cursor.ch===0)
codeMirror.execCommand("delCharBefore");else
return CodeMirror.Pass;}
-var modifierKey=WebInspector.isMac()?"Alt":"Ctrl";var leftKey=modifierKey+"-Left";var rightKey=modifierKey+"-Right";var keyMap={};keyMap[leftKey]=moveLeft.bind(this,false);keyMap[rightKey]=moveRight.bind(this,false);keyMap["Shift-"+leftKey]=moveLeft.bind(this,true);keyMap["Shift-"+rightKey]=moveRight.bind(this,true);keyMap[modifierKey+"-Backspace"]=delWordBack.bind(this);codeMirror.addKeyMap(keyMap);}
+var modifierKey=WebInspector.isMac()?"Alt":"Ctrl";var leftKey=modifierKey+"-Left";var rightKey=modifierKey+"-Right";var keyMap={};keyMap[leftKey]=moveLeft.bind(null,false);keyMap[rightKey]=moveRight.bind(null,false);keyMap["Shift-"+leftKey]=moveLeft.bind(null,true);keyMap["Shift-"+rightKey]=moveRight.bind(null,true);keyMap[modifierKey+"-Backspace"]=delWordBack;codeMirror.addKeyMap(keyMap);}
WebInspector.CodeMirrorTextEditor.AutocompleteController=function(textEditor,codeMirror)
{this._textEditor=textEditor;this._codeMirror=codeMirror;this._codeMirror.on("scroll",this._onScroll.bind(this));this._codeMirror.on("cursorActivity",this._onCursorActivity.bind(this));}
WebInspector.CodeMirrorTextEditor.AutocompleteController.prototype={autocomplete:function()
@@ -1451,4 +1475,13 @@
{if(!this._suggestBox)
return;var cursor=this._codeMirror.getCursor();if(cursor.line!==this._prefixRange.startLine||cursor.ch>this._prefixRange.endColumn||cursor.ch<this._prefixRange.startColumn)
this.finishAutocomplete();},_anchorBoxForPosition:function(line,column)
-{var metrics=this._textEditor.cursorPositionToCoordinates(line,column);return metrics?new AnchorBox(metrics.x,metrics.y,0,metrics.height):null;},}
+{var metrics=this._textEditor.cursorPositionToCoordinates(line,column);return metrics?new AnchorBox(metrics.x,metrics.y,0,metrics.height):null;},}
+WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens=function(modeName,tokenPrefix)
+{var oldModeName=modeName+"-old";if(CodeMirror.modes[oldModeName])
+return;CodeMirror.defineMode(oldModeName,CodeMirror.modes[modeName]);CodeMirror.defineMode(modeName,modeConstructor);function modeConstructor(config,parserConfig)
+{var innerConfig={};for(var i in parserConfig)
+innerConfig[i]=parserConfig[i];innerConfig.name=oldModeName;var codeMirrorMode=CodeMirror.getMode(config,innerConfig);codeMirrorMode.name=modeName;codeMirrorMode.token=tokenOverride.bind(null,codeMirrorMode.token);return codeMirrorMode;}
+function tokenOverride(superToken,stream,state)
+{var token=superToken(stream,state);return token?tokenPrefix+token:token;}}
+WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("css","css-");WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("javascript","js-");WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("xml","xml-");(function(){var backgroundColor=InspectorFrontendHost.getSelectionBackgroundColor();var backgroundColorRule=backgroundColor?".CodeMirror .CodeMirror-selected { background-color: "+backgroundColor+";}":"";var foregroundColor=InspectorFrontendHost.getSelectionForegroundColor();var foregroundColorRule=foregroundColor?".CodeMirror .CodeMirror-selectedtext:not(.CodeMirror-persist-highlight) { color: "+foregroundColor+"!important;}":"";if(!foregroundColorRule&&!backgroundColorRule)
+return;var style=document.createElement("style");style.textContent=backgroundColorRule+foregroundColorRule;document.head.appendChild(style);})();
« no previous file with comments | « chrome_linux/resources/inspector/AuditsPanel.js ('k') | chrome_linux/resources/inspector/ConsolePanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698