OLD | NEW |
1 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.documentMo
de==null||document.documentMode<9);var ie_gt10=/Trident\/([7-9]|\d{2,})\./.test(
navigator.userAgent);var webkit=/WebKit\//.test(navigator.userAgent);var qtwebki
t=webkit&&/Qt\/\d+\.\d+/.test(navigator.userAgent);var chrome=/Chrome\//.test(na
vigator.userAgent);var opera=/Opera\//.test(navigator.userAgent);var safari=/App
le 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 ma
c_geMountainLion=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent);var ph
antom=/PhantomJS/.test(navigator.userAgent);var ios=/AppleWebKit/.test(navigator
.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent);var mobile=ios||/Android|we
bOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent);var ma
c=ios||/Mac/.test(navigator.platform);var windows=/win/i.test(navigator.platform
);var opera_version=opera&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);if(o
pera_version)opera_version=Number(opera_version[1]);if(opera_version&&opera_vers
ion>=15){opera=false;webkit=true;} | 1 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&&(d
ocument.documentMode==null||document.documentMode<8);var ie_lt9=old_ie&&(documen
t.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\//.te
st(navigator.userAgent);var qtwebkit=webkit&&/Qt\/\d+\.\d+/.test(navigator.userA
gent);var chrome=/Chrome\//.test(navigator.userAgent);var opera=/Opera\//.test(n
avigator.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);v
ar ios=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.use
rAgent);var mobile=ios||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile
/i.test(navigator.userAgent);var mac=ios||/Mac/.test(navigator.platform);var win
dows=/win/i.test(navigator.platform);var opera_version=opera&&navigator.userAgen
t.match(/Version\/(\d*\.\d*)/);if(opera_version)opera_version=Number(opera_versi
on[1]);if(opera_version&&opera_version>=15){opera=false;webkit=true;} |
2 var flipCtrlCmd=mac&&(qtwebkit||opera&&(opera_version==null||opera_version<12.11
));var captureMiddleClick=gecko||(ie&&!ie_lt9);var sawReadOnlySpans=false,sawCol
lapsedSpans=false;function CodeMirror(place,options){if(!(this instanceof CodeMi
rror))return new CodeMirror(place,options);this.options=options=options||{};for(
var opt in defaults)if(!options.hasOwnProperty(opt)&&defaults.hasOwnProperty(opt
)) | 2 var flipCtrlCmd=mac&&(qtwebkit||opera&&(opera_version==null||opera_version<12.11
));var captureMiddleClick=gecko||(old_ie&&!ie_lt9);var sawReadOnlySpans=false,sa
wCollapsedSpans=false;function CodeMirror(place,options){if(!(this instanceof Co
deMirror))return new CodeMirror(place,options);this.options=options=options||{};
for(var opt in defaults)if(!options.hasOwnProperty(opt)&&defaults.hasOwnProperty
(opt)) |
3 options[opt]=defaults[opt];setGuttersForLineNumbers(options);var docStart=typeof
options.value=="string"?0:options.value.first;var display=this.display=makeDisp
lay(place,docStart);display.wrapper.CodeMirror=this;updateGutters(this);if(optio
ns.autofocus&&!mobile)focusInput(this);this.state={keyMaps:[],overlays:[],modeGe
n:0,overwrite:false,focused:false,suppressEdits:false,pasteIncoming:false,draggi
ngText:false,highlight:new Delayed()};themeChanged(this);if(options.lineWrapping
) | 3 options[opt]=defaults[opt];setGuttersForLineNumbers(options);var docStart=typeof
options.value=="string"?0:options.value.first;var display=this.display=makeDisp
lay(place,docStart);display.wrapper.CodeMirror=this;updateGutters(this);if(optio
ns.autofocus&&!mobile)focusInput(this);this.state={keyMaps:[],overlays:[],modeGe
n:0,overwrite:false,focused:false,suppressEdits:false,pasteIncoming:false,cutInc
oming:false,draggingText:false,highlight:new Delayed()};themeChanged(this);if(op
tions.lineWrapping) |
4 this.display.wrapper.className+=" CodeMirror-wrap";var doc=options.value;if(type
of doc=="string")doc=new Doc(options.value,options.mode);operation(this,attachDo
c)(this,doc);if(ie)setTimeout(bind(resetInput,this,true),20);registerEventHandle
rs(this);var hasFocus;try{hasFocus=(document.activeElement==display.input);}catc
h(e){} | 4 this.display.wrapper.className+=" CodeMirror-wrap";var doc=options.value;if(type
of doc=="string")doc=new Doc(options.value,options.mode);operation(this,attachDo
c)(this,doc);if(old_ie)setTimeout(bind(resetInput,this,true),20);registerEventHa
ndlers(this);var hasFocus;try{hasFocus=(document.activeElement==display.input);}
catch(e){} |
5 if(hasFocus||(options.autofocus&&!mobile))setTimeout(bind(onFocus,this),20);else
onBlur(this);operation(this,function(){for(var opt in optionHandlers) | 5 if(hasFocus||(options.autofocus&&!mobile))setTimeout(bind(onFocus,this),20);else
onBlur(this);operation(this,function(){for(var opt in optionHandlers) |
6 if(optionHandlers.propertyIsEnumerable(opt)) | 6 if(optionHandlers.propertyIsEnumerable(opt)) |
7 optionHandlers[opt](this,options[opt],Init);for(var i=0;i<initHooks.length;++i)i
nitHooks[i](this);})();} | 7 optionHandlers[opt](this,options[opt],Init);for(var i=0;i<initHooks.length;++i)i
nitHooks[i](this);})();} |
8 function makeDisplay(place,docStart){var d={};var input=d.input=elt("textarea",n
ull,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("a
utocorrect","off");input.setAttribute("autocapitalize","off");input.setAttribute
("spellcheck","false");d.inputDiv=elt("div",[input],null,"overflow: hidden; posi
tion: relative; width: 3px; height: 0px;");d.scrollbarH=elt("div",[elt("div",nul
l,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-gu
tter-filler");d.lineDiv=elt("div",null,"CodeMirror-code");d.selectionDiv=elt("di
v",null,null,"position: relative; z-index: 1");d.cursor=elt("div","\u00a0","Code
Mirror-cursor");d.otherCursor=elt("div","\u00a0","CodeMirror-cursor CodeMirror-s
econdarycursor");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],"CodeMirr
or-lines")],null,"position: relative");d.sizer=elt("div",[d.mover],"CodeMirror-s
izer");d.heightForcer=elt("div",null,null,"position: absolute; height: "+scrolle
rCutOff+"px; width: 1px;");d.gutters=elt("div",null,"CodeMirror-gutters");d.line
Gutter=null;d.scroller=elt("div",[d.sizer,d.heightForcer,d.gutters],"CodeMirror-
scroll");d.scroller.setAttribute("tabIndex","-1");d.wrapper=elt("div",[d.inputDi
v,d.scrollbarH,d.scrollbarV,d.scrollbarFiller,d.gutterFiller,d.scroller],"CodeMi
rror");if(ie_lt8){d.gutters.style.zIndex=-1;d.scroller.style.paddingRight=0;} | 8 function makeDisplay(place,docStart){var d={};var input=d.input=elt("textarea",n
ull,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("a
utocorrect","off");input.setAttribute("autocapitalize","off");input.setAttribute
("spellcheck","false");d.inputDiv=elt("div",[input],null,"overflow: hidden; posi
tion: relative; width: 3px; height: 0px;");d.scrollbarH=elt("div",[elt("div",nul
l,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-gu
tter-filler");d.lineDiv=elt("div",null,"CodeMirror-code");d.selectionDiv=elt("di
v",null,null,"position: relative; z-index: 1");d.cursor=elt("div","\u00a0","Code
Mirror-cursor");d.otherCursor=elt("div","\u00a0","CodeMirror-cursor CodeMirror-s
econdarycursor");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],"CodeMirr
or-lines")],null,"position: relative");d.sizer=elt("div",[d.mover],"CodeMirror-s
izer");d.heightForcer=elt("div",null,null,"position: absolute; height: "+scrolle
rCutOff+"px; width: 1px;");d.gutters=elt("div",null,"CodeMirror-gutters");d.line
Gutter=null;d.scroller=elt("div",[d.sizer,d.heightForcer,d.gutters],"CodeMirror-
scroll");d.scroller.setAttribute("tabIndex","-1");d.wrapper=elt("div",[d.inputDi
v,d.scrollbarH,d.scrollbarV,d.scrollbarFiller,d.gutterFiller,d.scroller],"CodeMi
rror");if(ie_lt8){d.gutters.style.zIndex=-1;d.scroller.style.paddingRight=0;} |
9 if(place.appendChild)place.appendChild(d.wrapper);else place(d.wrapper);if(ios)i
nput.style.width="0px";if(!webkit)d.scroller.draggable=true;if(khtml){d.inputDiv
.style.height="1px";d.inputDiv.style.position="absolute";} | 9 if(place.appendChild)place.appendChild(d.wrapper);else place(d.wrapper);if(ios)i
nput.style.width="0px";if(!webkit)d.scroller.draggable=true;if(khtml){d.inputDiv
.style.height="1px";d.inputDiv.style.position="absolute";} |
10 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.lin
eNumInnerWidth=d.lineNumChars=null;d.prevInput="";d.alignWidgets=false;d.polling
Fast=false;d.poll=new Delayed();d.cachedCharWidth=d.cachedTextHeight=null;d.meas
ureLineCache=[];d.measureLineCachePos=0;d.inaccurateSelection=false;d.maxLine=nu
ll;d.maxLineLength=0;d.maxLineChanged=false;d.wheelDX=d.wheelDY=d.wheelStartX=d.
wheelStartY=null;return d;} | 10 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.lin
eNumInnerWidth=d.lineNumChars=null;d.prevInput="";d.alignWidgets=false;d.polling
Fast=false;d.poll=new Delayed();d.cachedCharWidth=d.cachedTextHeight=null;d.meas
ureLineCache=[];d.measureLineCachePos=0;d.inaccurateSelection=false;d.maxLine=nu
ll;d.maxLineLength=0;d.maxLineChanged=false;d.wheelDX=d.wheelDY=d.wheelStartX=d.
wheelStartY=null;return d;} |
11 function loadMode(cm){cm.doc.mode=CodeMirror.getMode(cm.options,cm.doc.modeOptio
n);cm.doc.iter(function(line){if(line.stateAfter)line.stateAfter=null;if(line.st
yles)line.styles=null;});cm.doc.frontier=cm.doc.first;startWorker(cm,100);cm.sta
te.modeGen++;if(cm.curOp)regChange(cm);} | 11 function loadMode(cm){cm.doc.mode=CodeMirror.getMode(cm.options,cm.doc.modeOptio
n);resetModeState(cm);} |
| 12 function resetModeState(cm){cm.doc.iter(function(line){if(line.stateAfter)line.s
tateAfter=null;if(line.styles)line.styles=null;});cm.doc.frontier=cm.doc.first;s
tartWorker(cm,100);cm.state.modeGen++;if(cm.curOp)regChange(cm);} |
12 function wrappingChanged(cm){if(cm.options.lineWrapping){cm.display.wrapper.clas
sName+=" CodeMirror-wrap";cm.display.sizer.style.minWidth="";}else{cm.display.wr
apper.className=cm.display.wrapper.className.replace(" CodeMirror-wrap","");comp
uteMaxLength(cm);} | 13 function wrappingChanged(cm){if(cm.options.lineWrapping){cm.display.wrapper.clas
sName+=" CodeMirror-wrap";cm.display.sizer.style.minWidth="";}else{cm.display.wr
apper.className=cm.display.wrapper.className.replace(" CodeMirror-wrap","");comp
uteMaxLength(cm);} |
13 estimateLineHeights(cm);regChange(cm);clearCaches(cm);setTimeout(function(){upda
teScrollbars(cm);},100);} | 14 estimateLineHeights(cm);regChange(cm);clearCaches(cm);setTimeout(function(){upda
teScrollbars(cm);},100);} |
14 function estimateHeight(cm){var th=textHeight(cm.display),wrapping=cm.options.li
neWrapping;var perLine=wrapping&&Math.max(5,cm.display.scroller.clientWidth/char
Width(cm.display)-3);return function(line){if(lineIsHidden(cm.doc,line)) | 15 function estimateHeight(cm){var th=textHeight(cm.display),wrapping=cm.options.li
neWrapping;var perLine=wrapping&&Math.max(5,cm.display.scroller.clientWidth/char
Width(cm.display)-3);return function(line){if(lineIsHidden(cm.doc,line)) |
15 return 0;else if(wrapping) | 16 return 0;else if(wrapping) |
16 return(Math.ceil(line.text.length/perLine)||1)*th;else | 17 return(Math.ceil(line.text.length/perLine)||1)*th;else |
17 return th;};} | 18 return th;};} |
18 function estimateLineHeights(cm){var doc=cm.doc,est=estimateHeight(cm);doc.iter(
function(line){var estHeight=est(line);if(estHeight!=line.height)updateLineHeigh
t(line,estHeight);});} | 19 function estimateLineHeights(cm){var doc=cm.doc,est=estimateHeight(cm);doc.iter(
function(line){var estHeight=est(line);if(estHeight!=line.height)updateLineHeigh
t(line,estHeight);});} |
19 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,"")+ | 20 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,"")+ |
20 (style?" cm-keymap-"+style:"");cm.state.disableInput=map.disableInput;} | 21 (style?" cm-keymap-"+style:"");} |
21 function themeChanged(cm){cm.display.wrapper.className=cm.display.wrapper.classN
ame.replace(/\s*cm-s-\S+/g,"")+ | 22 function themeChanged(cm){cm.display.wrapper.className=cm.display.wrapper.classN
ame.replace(/\s*cm-s-\S+/g,"")+ |
22 cm.options.theme.replace(/(^|\s)\s*/g," cm-s-");clearCaches(cm);} | 23 cm.options.theme.replace(/(^|\s)\s*/g," cm-s-");clearCaches(cm);} |
23 function guttersChanged(cm){updateGutters(cm);regChange(cm);setTimeout(function(
){alignHorizontally(cm);},20);} | 24 function guttersChanged(cm){updateGutters(cm);regChange(cm);setTimeout(function(
){alignHorizontally(cm);},20);} |
24 function updateGutters(cm){var gutters=cm.display.gutters,specs=cm.options.gutte
rs;removeChildren(gutters);for(var i=0;i<specs.length;++i){var gutterClass=specs
[i];var gElt=gutters.appendChild(elt("div",null,"CodeMirror-gutter "+gutterClass
));if(gutterClass=="CodeMirror-linenumbers"){cm.display.lineGutter=gElt;gElt.sty
le.width=(cm.display.lineNumWidth||1)+"px";}} | 25 function updateGutters(cm){var gutters=cm.display.gutters,specs=cm.options.gutte
rs;removeChildren(gutters);for(var i=0;i<specs.length;++i){var gutterClass=specs
[i];var gElt=gutters.appendChild(elt("div",null,"CodeMirror-gutter "+gutterClass
));if(gutterClass=="CodeMirror-linenumbers"){cm.display.lineGutter=gElt;gElt.sty
le.width=(cm.display.lineNumWidth||1)+"px";}} |
25 gutters.style.display=i?"":"none";} | 26 gutters.style.display=i?"":"none";} |
26 function lineLength(doc,line){if(line.height==0)return 0;var len=line.text.lengt
h,merged,cur=line;while(merged=collapsedSpanAtStart(cur)){var found=merged.find(
);cur=getLine(doc,found.from.line);len+=found.from.ch-found.to.ch;} | 27 function lineLength(doc,line){if(line.height==0)return 0;var len=line.text.lengt
h,merged,cur=line;while(merged=collapsedSpanAtStart(cur)){var found=merged.find(
);cur=getLine(doc,found.from.line);len+=found.from.ch-found.to.ch;} |
27 cur=line;while(merged=collapsedSpanAtEnd(cur)){var found=merged.find();len-=cur.
text.length-found.from.ch;cur=getLine(doc,found.to.line);len+=cur.text.length-fo
und.to.ch;} | 28 cur=line;while(merged=collapsedSpanAtEnd(cur)){var found=merged.find();len-=cur.
text.length-found.from.ch;cur=getLine(doc,found.to.line);len+=cur.text.length-fo
und.to.ch;} |
28 return len;} | 29 return len;} |
29 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.i
ter(function(line){var len=lineLength(doc,line);if(len>d.maxLineLength){d.maxLin
eLength=len;d.maxLine=line;}});} | 30 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.i
ter(function(line){var len=lineLength(doc,line);if(len>d.maxLineLength){d.maxLin
eLength=len;d.maxLine=line;}});} |
30 function setGuttersForLineNumbers(options){var found=indexOf(options.gutters,"Co
deMirror-linenumbers");if(found==-1&&options.lineNumbers){options.gutters=option
s.gutters.concat(["CodeMirror-linenumbers"]);}else if(found>-1&&!options.lineNum
bers){options.gutters=options.gutters.slice(0);options.gutters.splice(found,1);}
} | 31 function setGuttersForLineNumbers(options){var found=indexOf(options.gutters,"Co
deMirror-linenumbers");if(found==-1&&options.lineNumbers){options.gutters=option
s.gutters.concat(["CodeMirror-linenumbers"]);}else if(found>-1&&!options.lineNum
bers){options.gutters=options.gutters.slice(0);options.gutters.splice(found,1);}
} |
31 function updateScrollbars(cm){var d=cm.display,docHeight=cm.doc.height;var total
Height=docHeight+paddingVert(d);d.sizer.style.minHeight=d.heightForcer.style.top
=totalHeight+"px";d.gutters.style.height=Math.max(totalHeight,d.scroller.clientH
eight-scrollerCutOff)+"px";var scrollHeight=Math.max(totalHeight,d.scroller.scro
llHeight);var needsH=d.scroller.scrollWidth>(d.scroller.clientWidth+1);var needs
V=scrollHeight>(d.scroller.clientHeight+1);if(needsV){d.scrollbarV.style.display
="block";d.scrollbarV.style.bottom=needsH?scrollbarWidth(d.measure)+"px":"0";d.s
crollbarV.firstChild.style.height=(scrollHeight-d.scroller.clientHeight+d.scroll
barV.clientHeight)+"px";}else{d.scrollbarV.style.display="";d.scrollbarV.firstCh
ild.style.height="0";} | 32 function updateScrollbars(cm){var d=cm.display,docHeight=cm.doc.height;var total
Height=docHeight+paddingVert(d);d.sizer.style.minHeight=d.heightForcer.style.top
=totalHeight+"px";d.gutters.style.height=Math.max(totalHeight,d.scroller.clientH
eight-scrollerCutOff)+"px";var scrollHeight=Math.max(totalHeight,d.scroller.scro
llHeight);var needsH=d.scroller.scrollWidth>(d.scroller.clientWidth+1);var needs
V=scrollHeight>(d.scroller.clientHeight+1);if(needsV){d.scrollbarV.style.display
="block";d.scrollbarV.style.bottom=needsH?scrollbarWidth(d.measure)+"px":"0";d.s
crollbarV.firstChild.style.height=Math.max(0,scrollHeight-d.scroller.clientHeigh
t+d.scrollbarV.clientHeight)+"px";}else{d.scrollbarV.style.display="";d.scrollba
rV.firstChild.style.height="0";} |
32 if(needsH){d.scrollbarH.style.display="block";d.scrollbarH.style.right=needsV?sc
rollbarWidth(d.measure)+"px":"0";d.scrollbarH.firstChild.style.width=(d.scroller
.scrollWidth-d.scroller.clientWidth+d.scrollbarH.clientWidth)+"px";}else{d.scrol
lbarH.style.display="";d.scrollbarH.firstChild.style.width="0";} | 33 if(needsH){d.scrollbarH.style.display="block";d.scrollbarH.style.right=needsV?sc
rollbarWidth(d.measure)+"px":"0";d.scrollbarH.firstChild.style.width=(d.scroller
.scrollWidth-d.scroller.clientWidth+d.scrollbarH.clientWidth)+"px";}else{d.scrol
lbarH.style.display="";d.scrollbarH.firstChild.style.width="0";} |
33 if(needsH&&needsV){d.scrollbarFiller.style.display="block";d.scrollbarFiller.sty
le.height=d.scrollbarFiller.style.width=scrollbarWidth(d.measure)+"px";}else d.s
crollbarFiller.style.display="";if(needsH&&cm.options.coverGutterNextToScrollbar
&&cm.options.fixedGutter){d.gutterFiller.style.display="block";d.gutterFiller.st
yle.height=scrollbarWidth(d.measure)+"px";d.gutterFiller.style.width=d.gutters.o
ffsetWidth+"px";}else d.gutterFiller.style.display="";if(mac_geLion&&scrollbarWi
dth(d.measure)===0){d.scrollbarV.style.minWidth=d.scrollbarH.style.minHeight=mac
_geMountainLion?"18px":"12px";d.scrollbarV.style.pointerEvents=d.scrollbarH.styl
e.pointerEvents="none";}} | 34 if(needsH&&needsV){d.scrollbarFiller.style.display="block";d.scrollbarFiller.sty
le.height=d.scrollbarFiller.style.width=scrollbarWidth(d.measure)+"px";}else d.s
crollbarFiller.style.display="";if(needsH&&cm.options.coverGutterNextToScrollbar
&&cm.options.fixedGutter){d.gutterFiller.style.display="block";d.gutterFiller.st
yle.height=scrollbarWidth(d.measure)+"px";d.gutterFiller.style.width=d.gutters.o
ffsetWidth+"px";}else d.gutterFiller.style.display="";if(mac_geLion&&scrollbarWi
dth(d.measure)===0){d.scrollbarV.style.minWidth=d.scrollbarH.style.minHeight=mac
_geMountainLion?"18px":"12px";d.scrollbarV.style.pointerEvents=d.scrollbarH.styl
e.pointerEvents="none";}} |
34 function visibleLines(display,doc,viewPort){var top=display.scroller.scrollTop,h
eight=display.wrapper.clientHeight;if(typeof viewPort=="number")top=viewPort;els
e if(viewPort){top=viewPort.top;height=viewPort.bottom-viewPort.top;} | 35 function visibleLines(display,doc,viewPort){var top=display.scroller.scrollTop,h
eight=display.wrapper.clientHeight;if(typeof viewPort=="number")top=viewPort;els
e if(viewPort){top=viewPort.top;height=viewPort.bottom-viewPort.top;} |
35 top=Math.floor(top-paddingTop(display));var bottom=Math.ceil(top+height);return{
from:lineAtHeight(doc,top),to:lineAtHeight(doc,bottom)};} | 36 top=Math.floor(top-paddingTop(display));var bottom=Math.ceil(top+height);return{
from:lineAtHeight(doc,top),to:lineAtHeight(doc,bottom)};} |
36 function alignHorizontally(cm){var display=cm.display;if(!display.alignWidgets&&
(!display.gutters.firstChild||!cm.options.fixedGutter))return;var comp=compensat
eForHScroll(display)-display.scroller.scrollLeft+cm.doc.scrollLeft;var gutterW=d
isplay.gutters.offsetWidth,l=comp+"px";for(var n=display.lineDiv.firstChild;n;n=
n.nextSibling)if(n.alignable){for(var i=0,a=n.alignable;i<a.length;++i)a[i].styl
e.left=l;} | 37 function alignHorizontally(cm){var display=cm.display;if(!display.alignWidgets&&
(!display.gutters.firstChild||!cm.options.fixedGutter))return;var comp=compensat
eForHScroll(display)-display.scroller.scrollLeft+cm.doc.scrollLeft;var gutterW=d
isplay.gutters.offsetWidth,l=comp+"px";for(var n=display.lineDiv.firstChild;n;n=
n.nextSibling)if(n.alignable){for(var i=0,a=n.alignable;i<a.length;++i)a[i].styl
e.left=l;} |
37 if(cm.options.fixedGutter) | 38 if(cm.options.fixedGutter) |
38 display.gutters.style.left=(comp+gutterW)+"px";} | 39 display.gutters.style.left=(comp+gutterW)+"px";} |
39 function maybeUpdateLineNumberWidth(cm){if(!cm.options.lineNumbers)return false;
var doc=cm.doc,last=lineNumberFor(cm.options,doc.first+doc.size-1),display=cm.di
splay;if(last.length!=display.lineNumChars){var test=display.measure.appendChild
(elt("div",[elt("div",last)],"CodeMirror-linenumber CodeMirror-gutter-elt"));var
innerW=test.firstChild.offsetWidth,padding=test.offsetWidth-innerW;display.line
Gutter.style.width="";display.lineNumInnerWidth=Math.max(innerW,display.lineGutt
er.offsetWidth-padding);display.lineNumWidth=display.lineNumInnerWidth+padding;d
isplay.lineNumChars=display.lineNumInnerWidth?last.length:-1;display.lineGutter.
style.width=display.lineNumWidth+"px";return true;} | 40 function maybeUpdateLineNumberWidth(cm){if(!cm.options.lineNumbers)return false;
var doc=cm.doc,last=lineNumberFor(cm.options,doc.first+doc.size-1),display=cm.di
splay;if(last.length!=display.lineNumChars){var test=display.measure.appendChild
(elt("div",[elt("div",last)],"CodeMirror-linenumber CodeMirror-gutter-elt"));var
innerW=test.firstChild.offsetWidth,padding=test.offsetWidth-innerW;display.line
Gutter.style.width="";display.lineNumInnerWidth=Math.max(innerW,display.lineGutt
er.offsetWidth-padding);display.lineNumWidth=display.lineNumInnerWidth+padding;d
isplay.lineNumChars=display.lineNumInnerWidth?last.length:-1;display.lineGutter.
style.width=display.lineNumWidth+"px";return true;} |
40 return false;} | 41 return false;} |
41 function lineNumberFor(options,i){return String(options.lineNumberFormatter(i+op
tions.firstLineNumber));} | 42 function lineNumberFor(options,i){return String(options.lineNumberFormatter(i+op
tions.firstLineNumber));} |
42 function compensateForHScroll(display){return getRect(display.scroller).left-get
Rect(display.sizer).left;} | 43 function compensateForHScroll(display){return getRect(display.scroller).left-get
Rect(display.sizer).left;} |
43 function updateDisplay(cm,changes,viewPort,forced){var oldFrom=cm.display.showin
gFrom,oldTo=cm.display.showingTo,updated;var visible=visibleLines(cm.display,cm.
doc,viewPort);for(var first=true;;first=false){var oldWidth=cm.display.scroller.
clientWidth;if(!updateDisplayInner(cm,changes,visible,forced))break;updated=true
;changes=[];updateSelection(cm);updateScrollbars(cm);if(first&&cm.options.lineWr
apping&&oldWidth!=cm.display.scroller.clientWidth){forced=true;continue;} | 44 function updateDisplay(cm,changes,viewPort,forced){var oldFrom=cm.display.showin
gFrom,oldTo=cm.display.showingTo,updated;var visible=visibleLines(cm.display,cm.
doc,viewPort);for(var first=true;;first=false){var oldWidth=cm.display.scroller.
clientWidth;if(!updateDisplayInner(cm,changes,visible,forced))break;updated=true
;changes=[];updateSelection(cm);updateScrollbars(cm);if(first&&cm.options.lineWr
apping&&oldWidth!=cm.display.scroller.clientWidth){forced=true;continue;} |
44 forced=false;if(viewPort) | 45 forced=false;if(viewPort) |
45 viewPort=Math.min(cm.display.scroller.scrollHeight-cm.display.scroller.clientHei
ght,typeof viewPort=="number"?viewPort:viewPort.top);visible=visibleLines(cm.dis
play,cm.doc,viewPort);if(visible.from>=cm.display.showingFrom&&visible.to<=cm.di
splay.showingTo) | 46 viewPort=Math.min(cm.display.scroller.scrollHeight-cm.display.scroller.clientHei
ght,typeof viewPort=="number"?viewPort:viewPort.top);visible=visibleLines(cm.dis
play,cm.doc,viewPort);if(visible.from>=cm.display.showingFrom&&visible.to<=cm.di
splay.showingTo) |
46 break;} | 47 break;} |
47 if(updated){signalLater(cm,"update",cm);if(cm.display.showingFrom!=oldFrom||cm.d
isplay.showingTo!=oldTo) | 48 if(updated){signalLater(cm,"update",cm);if(cm.display.showingFrom!=oldFrom||cm.d
isplay.showingTo!=oldTo) |
48 signalLater(cm,"viewportChange",cm,cm.display.showingFrom,cm.display.showingTo);
} | 49 signalLater(cm,"viewportChange",cm,cm.display.showingFrom,cm.display.showingTo);
} |
49 return updated;} | 50 return updated;} |
50 function updateDisplayInner(cm,changes,visible,forced){var display=cm.display,do
c=cm.doc;if(!display.wrapper.clientWidth){display.showingFrom=display.showingTo=
doc.first;display.viewOffset=0;return;} | 51 function updateDisplayInner(cm,changes,visible,forced){var display=cm.display,do
c=cm.doc;if(!display.wrapper.offsetWidth){display.showingFrom=display.showingTo=
doc.first;display.viewOffset=0;return;} |
51 if(!forced&&changes.length==0&&visible.from>display.showingFrom&&visible.to<disp
lay.showingTo) | 52 if(!forced&&changes.length==0&&visible.from>display.showingFrom&&visible.to<disp
lay.showingTo) |
52 return;if(maybeUpdateLineNumberWidth(cm)) | 53 return;if(maybeUpdateLineNumberWidth(cm)) |
53 changes=[{from:doc.first,to:doc.first+doc.size}];var gutterW=display.sizer.style
.marginLeft=display.gutters.offsetWidth+"px";display.scrollbarH.style.left=cm.op
tions.fixedGutter?gutterW:"0";var positionsChangedFrom=Infinity;if(cm.options.li
neNumbers) | 54 changes=[{from:doc.first,to:doc.first+doc.size}];var gutterW=display.sizer.style
.marginLeft=display.gutters.offsetWidth+"px";display.scrollbarH.style.left=cm.op
tions.fixedGutter?gutterW:"0";var positionsChangedFrom=Infinity;if(cm.options.li
neNumbers) |
54 for(var i=0;i<changes.length;++i) | 55 for(var i=0;i<changes.length;++i) |
55 if(changes[i].diff&&changes[i].from<positionsChangedFrom){positionsChangedFrom=c
hanges[i].from;} | 56 if(changes[i].diff&&changes[i].from<positionsChangedFrom){positionsChangedFrom=c
hanges[i].from;} |
56 var end=doc.first+doc.size;var from=Math.max(visible.from-cm.options.viewportMar
gin,doc.first);var to=Math.min(end,visible.to+cm.options.viewportMargin);if(disp
lay.showingFrom<from&&from-display.showingFrom<20)from=Math.max(doc.first,displa
y.showingFrom);if(display.showingTo>to&&display.showingTo-to<20)to=Math.min(end,
display.showingTo);if(sawCollapsedSpans){from=lineNo(visualLine(doc,getLine(doc,
from)));while(to<end&&lineIsHidden(doc,getLine(doc,to)))++to;} | 57 var end=doc.first+doc.size;var from=Math.max(visible.from-cm.options.viewportMar
gin,doc.first);var to=Math.min(end,visible.to+cm.options.viewportMargin);if(disp
lay.showingFrom<from&&from-display.showingFrom<20)from=Math.max(doc.first,displa
y.showingFrom);if(display.showingTo>to&&display.showingTo-to<20)to=Math.min(end,
display.showingTo);if(sawCollapsedSpans){from=lineNo(visualLine(doc,getLine(doc,
from)));while(to<end&&lineIsHidden(doc,getLine(doc,to)))++to;} |
57 var intact=[{from:Math.max(display.showingFrom,doc.first),to:Math.min(display.sh
owingTo,end)}];if(intact[0].from>=intact[0].to)intact=[];else intact=computeInta
ct(intact,changes);if(sawCollapsedSpans) | 58 var intact=[{from:Math.max(display.showingFrom,doc.first),to:Math.min(display.sh
owingTo,end)}];if(intact[0].from>=intact[0].to)intact=[];else intact=computeInta
ct(intact,changes);if(sawCollapsedSpans) |
58 for(var i=0;i<intact.length;++i){var range=intact[i],merged;while(merged=collaps
edSpanAtEnd(getLine(doc,range.to-1))){var newTo=merged.find().from.line;if(newTo
>range.from)range.to=newTo;else{intact.splice(i--,1);break;}}} | 59 for(var i=0;i<intact.length;++i){var range=intact[i],merged;while(merged=collaps
edSpanAtEnd(getLine(doc,range.to-1))){var newTo=merged.find().from.line;if(newTo
>range.from)range.to=newTo;else{intact.splice(i--,1);break;}}} |
59 var intactLines=0;for(var i=0;i<intact.length;++i){var range=intact[i];if(range.
from<from)range.from=from;if(range.to>to)range.to=to;if(range.from>=range.to)int
act.splice(i--,1);else intactLines+=range.to-range.from;} | 60 var intactLines=0;for(var i=0;i<intact.length;++i){var range=intact[i];if(range.
from<from)range.from=from;if(range.to>to)range.to=to;if(range.from>=range.to)int
act.splice(i--,1);else intactLines+=range.to-range.from;} |
60 if(!forced&&intactLines==to-from&&from==display.showingFrom&&to==display.showing
To){updateViewOffset(cm);return;} | 61 if(!forced&&intactLines==to-from&&from==display.showingFrom&&to==display.showing
To){updateViewOffset(cm);return;} |
61 intact.sort(function(a,b){return a.from-b.from;});try{var focused=document.activ
eElement;}catch(e){} | 62 intact.sort(function(a,b){return a.from-b.from;});try{var focused=document.activ
eElement;}catch(e){} |
62 if(intactLines<(to-from)*.7)display.lineDiv.style.display="none";patchDisplay(cm
,from,to,intact,positionsChangedFrom);display.lineDiv.style.display="";if(focuse
d&&document.activeElement!=focused&&focused.offsetHeight)focused.focus();var dif
ferent=from!=display.showingFrom||to!=display.showingTo||display.lastSizeC!=disp
lay.wrapper.clientHeight;if(different){display.lastSizeC=display.wrapper.clientH
eight;startWorker(cm,400);} | 63 if(intactLines<(to-from)*.7)display.lineDiv.style.display="none";patchDisplay(cm
,from,to,intact,positionsChangedFrom);display.lineDiv.style.display="";if(focuse
d&&document.activeElement!=focused&&focused.offsetHeight)focused.focus();var dif
ferent=from!=display.showingFrom||to!=display.showingTo||display.lastSizeC!=disp
lay.wrapper.clientHeight;if(different){display.lastSizeC=display.wrapper.clientH
eight;startWorker(cm,400);} |
63 display.showingFrom=from;display.showingTo=to;updateHeightsInViewport(cm);update
ViewOffset(cm);return true;} | 64 display.showingFrom=from;display.showingTo=to;display.gutters.style.height="";up
dateHeightsInViewport(cm);updateViewOffset(cm);return true;} |
64 function updateHeightsInViewport(cm){var display=cm.display;var prevBottom=displ
ay.lineDiv.offsetTop;for(var node=display.lineDiv.firstChild,height;node;node=no
de.nextSibling)if(node.lineObj){if(ie_lt8){var bot=node.offsetTop+node.offsetHei
ght;height=bot-prevBottom;prevBottom=bot;}else{var box=getRect(node);height=box.
bottom-box.top;} | 65 function updateHeightsInViewport(cm){var display=cm.display;var prevBottom=displ
ay.lineDiv.offsetTop;for(var node=display.lineDiv.firstChild,height;node;node=no
de.nextSibling)if(node.lineObj){if(ie_lt8){var bot=node.offsetTop+node.offsetHei
ght;height=bot-prevBottom;prevBottom=bot;}else{var box=getRect(node);height=box.
bottom-box.top;} |
65 var diff=node.lineObj.height-height;if(height<2)height=textHeight(display);if(di
ff>.001||diff<-.001){updateLineHeight(node.lineObj,height);var widgets=node.line
Obj.widgets;if(widgets)for(var i=0;i<widgets.length;++i) | 66 var diff=node.lineObj.height-height;if(height<2)height=textHeight(display);if(di
ff>.001||diff<-.001){updateLineHeight(node.lineObj,height);var widgets=node.line
Obj.widgets;if(widgets)for(var i=0;i<widgets.length;++i) |
66 widgets[i].height=widgets[i].node.offsetHeight;}}} | 67 widgets[i].height=widgets[i].node.offsetHeight;}}} |
67 function updateViewOffset(cm){var off=cm.display.viewOffset=heightAtLine(cm,getL
ine(cm.doc,cm.display.showingFrom));cm.display.mover.style.top=off+"px";} | 68 function updateViewOffset(cm){var off=cm.display.viewOffset=heightAtLine(cm,getL
ine(cm.doc,cm.display.showingFrom));cm.display.mover.style.top=off+"px";} |
68 function computeIntact(intact,changes){for(var i=0,l=changes.length||0;i<l;++i){
var change=changes[i],intact2=[],diff=change.diff||0;for(var j=0,l2=intact.lengt
h;j<l2;++j){var range=intact[j];if(change.to<=range.from&&change.diff){intact2.p
ush({from:range.from+diff,to:range.to+diff});}else if(change.to<=range.from||cha
nge.from>=range.to){intact2.push(range);}else{if(change.from>range.from) | 69 function computeIntact(intact,changes){for(var i=0,l=changes.length||0;i<l;++i){
var change=changes[i],intact2=[],diff=change.diff||0;for(var j=0,l2=intact.lengt
h;j<l2;++j){var range=intact[j];if(change.to<=range.from&&change.diff){intact2.p
ush({from:range.from+diff,to:range.to+diff});}else if(change.to<=range.from||cha
nge.from>=range.to){intact2.push(range);}else{if(change.from>range.from) |
69 intact2.push({from:range.from,to:change.from});if(change.to<range.to) | 70 intact2.push({from:range.from,to:change.from});if(change.to<range.to) |
70 intact2.push({from:change.to+diff,to:range.to+diff});}} | 71 intact2.push({from:change.to+diff,to:range.to+diff});}} |
71 intact=intact2;} | 72 intact=intact2;} |
72 return intact;} | 73 return intact;} |
73 function getDimensions(cm){var d=cm.display,left={},width={};for(var n=d.gutters
.firstChild,i=0;n;n=n.nextSibling,++i){left[cm.options.gutters[i]]=n.offsetLeft;
width[cm.options.gutters[i]]=n.offsetWidth;} | 74 function getDimensions(cm){var d=cm.display,left={},width={};for(var n=d.gutters
.firstChild,i=0;n;n=n.nextSibling,++i){left[cm.options.gutters[i]]=n.offsetLeft;
width[cm.options.gutters[i]]=n.offsetWidth;} |
74 return{fixedPos:compensateForHScroll(d),gutterTotalWidth:d.gutters.offsetWidth,g
utterLeft:left,gutterWidth:width,wrapperWidth:d.wrapper.clientWidth};} | 75 return{fixedPos:compensateForHScroll(d),gutterTotalWidth:d.gutters.offsetWidth,g
utterLeft:left,gutterWidth:width,wrapperWidth:d.wrapper.clientWidth};} |
75 function patchDisplay(cm,from,to,intact,updateNumbersFrom){var dims=getDimension
s(cm);var display=cm.display,lineNumbers=cm.options.lineNumbers;if(!intact.lengt
h&&(!webkit||!cm.display.currentWheelTarget)) | 76 function patchDisplay(cm,from,to,intact,updateNumbersFrom){var dims=getDimension
s(cm);var display=cm.display,lineNumbers=cm.options.lineNumbers;if(!intact.lengt
h&&(!webkit||!cm.display.currentWheelTarget)) |
76 removeChildren(display.lineDiv);var container=display.lineDiv,cur=container.firs
tChild;function rm(node){var next=node.nextSibling;if(webkit&&mac&&cm.display.cu
rrentWheelTarget==node){node.style.display="none";node.lineObj=null;}else{node.p
arentNode.removeChild(node);} | 77 removeChildren(display.lineDiv);var container=display.lineDiv,cur=container.firs
tChild;function rm(node){var next=node.nextSibling;if(webkit&&mac&&cm.display.cu
rrentWheelTarget==node){node.style.display="none";node.lineObj=null;}else{node.p
arentNode.removeChild(node);} |
77 return next;} | 78 return next;} |
78 var nextIntact=intact.shift(),lineN=from;cm.doc.iter(from,to,function(line){if(n
extIntact&&nextIntact.to==lineN)nextIntact=intact.shift();if(lineIsHidden(cm.doc
,line)){if(line.height!=0)updateLineHeight(line,0);if(line.widgets&&cur&&cur.pre
viousSibling)for(var i=0;i<line.widgets.length;++i){var w=line.widgets[i];if(w.s
howIfHidden){var prev=cur.previousSibling;if(/pre/i.test(prev.nodeName)){var wra
p=elt("div",null,null,"position: relative");prev.parentNode.replaceChild(wrap,pr
ev);wrap.appendChild(prev);prev=wrap;} | 79 var nextIntact=intact.shift(),lineN=from;cm.doc.iter(from,to,function(line){if(n
extIntact&&nextIntact.to==lineN)nextIntact=intact.shift();if(lineIsHidden(cm.doc
,line)){if(line.height!=0)updateLineHeight(line,0);if(line.widgets&&cur&&cur.pre
viousSibling)for(var i=0;i<line.widgets.length;++i){var w=line.widgets[i];if(w.s
howIfHidden){var prev=cur.previousSibling;if(/pre/i.test(prev.nodeName)){var wra
p=elt("div",null,null,"position: relative");prev.parentNode.replaceChild(wrap,pr
ev);wrap.appendChild(prev);prev=wrap;} |
79 var wnode=prev.appendChild(elt("div",[w.node],"CodeMirror-linewidget"));if(!w.ha
ndleMouseEvents)wnode.ignoreEvents=true;positionLineWidget(w,wnode,prev,dims);}}
}else if(nextIntact&&nextIntact.from<=lineN&&nextIntact.to>lineN){while(cur.line
Obj!=line)cur=rm(cur);if(lineNumbers&&updateNumbersFrom<=lineN&&cur.lineNumber) | 80 var wnode=prev.appendChild(elt("div",[w.node],"CodeMirror-linewidget"));if(!w.ha
ndleMouseEvents)wnode.ignoreEvents=true;positionLineWidget(w,wnode,prev,dims);}}
}else if(nextIntact&&nextIntact.from<=lineN&&nextIntact.to>lineN){while(cur.line
Obj!=line)cur=rm(cur);if(lineNumbers&&updateNumbersFrom<=lineN&&cur.lineNumber) |
80 setTextContent(cur.lineNumber,lineNumberFor(cm.options,lineN));cur=cur.nextSibli
ng;}else{if(line.widgets)for(var j=0,search=cur,reuse;search&&j<20;++j,search=se
arch.nextSibling) | 81 setTextContent(cur.lineNumber,lineNumberFor(cm.options,lineN));cur=cur.nextSibli
ng;}else{if(line.widgets)for(var j=0,search=cur,reuse;search&&j<20;++j,search=se
arch.nextSibling) |
81 if(search.lineObj==line&&/div/i.test(search.nodeName)){reuse=search;break;} | 82 if(search.lineObj==line&&/div/i.test(search.nodeName)){reuse=search;break;} |
82 var lineNode=buildLineElement(cm,line,lineN,dims,reuse);if(lineNode!=reuse){cont
ainer.insertBefore(lineNode,cur);}else{while(cur!=reuse)cur=rm(cur);cur=cur.next
Sibling;} | 83 var lineNode=buildLineElement(cm,line,lineN,dims,reuse);if(lineNode!=reuse){cont
ainer.insertBefore(lineNode,cur);}else{while(cur!=reuse)cur=rm(cur);cur=cur.next
Sibling;} |
83 lineNode.lineObj=line;} | 84 lineNode.lineObj=line;} |
84 ++lineN;});while(cur)cur=rm(cur);} | 85 ++lineN;});while(cur)cur=rm(cur);} |
85 function buildLineElement(cm,line,lineNo,dims,reuse){var built=buildLineContent(
cm,line),lineElement=built.pre;var markers=line.gutterMarkers,display=cm.display
,wrap;var bgClass=built.bgClass?built.bgClass+" "+(line.bgClass||""):line.bgClas
s;if(!cm.options.lineNumbers&&!markers&&!bgClass&&!line.wrapClass&&!line.widgets
) | 86 function buildLineElement(cm,line,lineNo,dims,reuse){var built=buildLineContent(
cm,line),lineElement=built.pre;var markers=line.gutterMarkers,display=cm.display
,wrap;var bgClass=built.bgClass?built.bgClass+" "+(line.bgClass||""):line.bgClas
s;if(!cm.options.lineNumbers&&!markers&&!bgClass&&!line.wrapClass&&!line.widgets
) |
86 return lineElement;if(reuse){reuse.alignable=null;var isOk=true,widgetsSeen=0,in
sertBefore=null;for(var n=reuse.firstChild,next;n;n=next){next=n.nextSibling;if(
!/\bCodeMirror-linewidget\b/.test(n.className)){reuse.removeChild(n);}else{for(v
ar i=0;i<line.widgets.length;++i){var widget=line.widgets[i];if(widget.node==n.f
irstChild){if(!widget.above&&!insertBefore)insertBefore=n;positionLineWidget(wid
get,n,reuse,dims);++widgetsSeen;break;}} | 87 return lineElement;if(reuse){reuse.alignable=null;var isOk=true,widgetsSeen=0,in
sertBefore=null;for(var n=reuse.firstChild,next;n;n=next){next=n.nextSibling;if(
!/\bCodeMirror-linewidget\b/.test(n.className)){reuse.removeChild(n);}else{for(v
ar i=0;i<line.widgets.length;++i){var widget=line.widgets[i];if(widget.node==n.f
irstChild){if(!widget.above&&!insertBefore)insertBefore=n;positionLineWidget(wid
get,n,reuse,dims);++widgetsSeen;break;}} |
87 if(i==line.widgets.length){isOk=false;break;}}} | 88 if(i==line.widgets.length){isOk=false;break;}}} |
88 reuse.insertBefore(lineElement,insertBefore);if(isOk&&widgetsSeen==line.widgets.
length){wrap=reuse;reuse.className=line.wrapClass||"";}} | 89 reuse.insertBefore(lineElement,insertBefore);if(isOk&&widgetsSeen==line.widgets.
length){wrap=reuse;reuse.className=line.wrapClass||"";}} |
89 if(!wrap){wrap=elt("div",null,line.wrapClass,"position: relative");wrap.appendCh
ild(lineElement);} | 90 if(!wrap){wrap=elt("div",null,line.wrapClass,"position: relative");wrap.appendCh
ild(lineElement);} |
90 if(bgClass) | 91 if(bgClass) |
91 wrap.insertBefore(elt("div",null,bgClass+" CodeMirror-linebackground"),wrap.firs
tChild);if(cm.options.lineNumbers||markers){var gutterWrap=wrap.insertBefore(elt
("div",null,null,"position: absolute; left: "+ | 92 wrap.insertBefore(elt("div",null,bgClass+" CodeMirror-linebackground"),wrap.firs
tChild);if(cm.options.lineNumbers||markers){var gutterWrap=wrap.insertBefore(elt
("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+ |
92 (cm.options.fixedGutter?dims.fixedPos:-dims.gutterTotalWidth)+"px"),wrap.firstCh
ild);if(cm.options.fixedGutter)(wrap.alignable||(wrap.alignable=[])).push(gutter
Wrap);if(cm.options.lineNumbers&&(!markers||!markers["CodeMirror-linenumbers"])) | 93 (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"])) |
93 wrap.lineNumber=gutterWrap.appendChild(elt("div",lineNumberFor(cm.options,lineNo
),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+dims.gutterLeft["CodeMi
rror-linenumbers"]+"px; width: " | 94 wrap.lineNumber=gutterWrap.appendChild(elt("div",lineNumberFor(cm.options,lineNo
),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+dims.gutterLeft["CodeMi
rror-linenumbers"]+"px; width: " |
94 +display.lineNumInnerWidth+"px"));if(markers) | 95 +display.lineNumInnerWidth+"px"));if(markers) |
95 for(var k=0;k<cm.options.gutters.length;++k){var id=cm.options.gutters[k],found=
markers.hasOwnProperty(id)&&markers[id];if(found) | 96 for(var k=0;k<cm.options.gutters.length;++k){var id=cm.options.gutters[k],found=
markers.hasOwnProperty(id)&&markers[id];if(found) |
96 gutterWrap.appendChild(elt("div",[found],"CodeMirror-gutter-elt","left: "+ | 97 gutterWrap.appendChild(elt("div",[found],"CodeMirror-gutter-elt","left: "+ |
97 dims.gutterLeft[id]+"px; width: "+dims.gutterWidth[id]+"px"));}} | 98 dims.gutterLeft[id]+"px; width: "+dims.gutterWidth[id]+"px"));}} |
98 if(ie_lt8)wrap.style.zIndex=2;if(line.widgets&&wrap!=reuse)for(var i=0,ws=line.w
idgets;i<ws.length;++i){var widget=ws[i],node=elt("div",[widget.node],"CodeMirro
r-linewidget");if(!widget.handleMouseEvents)node.ignoreEvents=true;positionLineW
idget(widget,node,wrap,dims);if(widget.above) | 99 if(ie_lt8)wrap.style.zIndex=2;if(line.widgets&&wrap!=reuse)for(var i=0,ws=line.w
idgets;i<ws.length;++i){var widget=ws[i],node=elt("div",[widget.node],"CodeMirro
r-linewidget");if(!widget.handleMouseEvents)node.ignoreEvents=true;positionLineW
idget(widget,node,wrap,dims);if(widget.above) |
99 wrap.insertBefore(node,cm.options.lineNumbers&&line.height!=0?gutterWrap:lineEle
ment);else | 100 wrap.insertBefore(node,cm.options.lineNumbers&&line.height!=0?gutterWrap:lineEle
ment);else |
100 wrap.appendChild(node);signalLater(widget,"redraw");} | 101 wrap.appendChild(node);signalLater(widget,"redraw");} |
101 return wrap;} | 102 return wrap;} |
102 function positionLineWidget(widget,node,wrap,dims){if(widget.noHScroll){(wrap.al
ignable||(wrap.alignable=[])).push(node);var width=dims.wrapperWidth;node.style.
left=dims.fixedPos+"px";if(!widget.coverGutter){width-=dims.gutterTotalWidth;nod
e.style.paddingLeft=dims.gutterTotalWidth+"px";} | 103 function positionLineWidget(widget,node,wrap,dims){if(widget.noHScroll){(wrap.al
ignable||(wrap.alignable=[])).push(node);var width=dims.wrapperWidth;node.style.
left=dims.fixedPos+"px";if(!widget.coverGutter){width-=dims.gutterTotalWidth;nod
e.style.paddingLeft=dims.gutterTotalWidth+"px";} |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 function paddingVert(display){return display.mover.offsetHeight-display.lineSpac
e.offsetHeight;} | 137 function paddingVert(display){return display.mover.offsetHeight-display.lineSpac
e.offsetHeight;} |
137 function paddingLeft(display){var e=removeChildrenAndAdd(display.measure,elt("pr
e",null,null,"text-align: left")).appendChild(elt("span","x"));return e.offsetLe
ft;} | 138 function paddingLeft(display){var e=removeChildrenAndAdd(display.measure,elt("pr
e",null,null,"text-align: left")).appendChild(elt("span","x"));return e.offsetLe
ft;} |
138 function measureChar(cm,line,ch,data,bias){var dir=-1;data=data||measureLine(cm,
line);if(data.crude){var left=data.left+ch*data.width;return{left:left,right:lef
t+data.width,top:data.top,bottom:data.bottom};} | 139 function measureChar(cm,line,ch,data,bias){var dir=-1;data=data||measureLine(cm,
line);if(data.crude){var left=data.left+ch*data.width;return{left:left,right:lef
t+data.width,top:data.top,bottom:data.bottom};} |
139 for(var pos=ch;;pos+=dir){var r=data[pos];if(r)break;if(dir<0&&pos==0)dir=1;} | 140 for(var pos=ch;;pos+=dir){var r=data[pos];if(r)break;if(dir<0&&pos==0)dir=1;} |
140 bias=pos>ch?"left":pos<ch?"right":bias;if(bias=="left"&&r.leftSide)r=r.leftSide;
else if(bias=="right"&&r.rightSide)r=r.rightSide;return{left:pos<ch?r.right:r.le
ft,right:pos>ch?r.left:r.right,top:r.top,bottom:r.bottom};} | 141 bias=pos>ch?"left":pos<ch?"right":bias;if(bias=="left"&&r.leftSide)r=r.leftSide;
else if(bias=="right"&&r.rightSide)r=r.rightSide;return{left:pos<ch?r.right:r.le
ft,right:pos>ch?r.left:r.right,top:r.top,bottom:r.bottom};} |
141 function findCachedMeasurement(cm,line){var cache=cm.display.measureLineCache;fo
r(var i=0;i<cache.length;++i){var memo=cache[i];if(memo.text==line.text&&memo.ma
rkedSpans==line.markedSpans&&cm.display.scroller.clientWidth==memo.width&&memo.c
lasses==line.textClass+"|"+line.wrapClass) | 142 function findCachedMeasurement(cm,line){var cache=cm.display.measureLineCache;fo
r(var i=0;i<cache.length;++i){var memo=cache[i];if(memo.text==line.text&&memo.ma
rkedSpans==line.markedSpans&&cm.display.scroller.clientWidth==memo.width&&memo.c
lasses==line.textClass+"|"+line.wrapClass) |
142 return memo;}} | 143 return memo;}} |
143 function clearCachedMeasurement(cm,line){var exists=findCachedMeasurement(cm,lin
e);if(exists)exists.text=exists.measure=exists.markedSpans=null;} | 144 function clearCachedMeasurement(cm,line){var exists=findCachedMeasurement(cm,lin
e);if(exists)exists.text=exists.measure=exists.markedSpans=null;} |
144 function measureLine(cm,line){var cached=findCachedMeasurement(cm,line);if(cache
d)return cached.measure;var measure=measureLineInner(cm,line);var cache=cm.displ
ay.measureLineCache;var memo={text:line.text,width:cm.display.scroller.clientWid
th,markedSpans:line.markedSpans,measure:measure,classes:line.textClass+"|"+line.
wrapClass};if(cache.length==16)cache[++cm.display.measureLineCachePos%16]=memo;e
lse cache.push(memo);return measure;} | 145 function measureLine(cm,line){var cached=findCachedMeasurement(cm,line);if(cache
d)return cached.measure;var measure=measureLineInner(cm,line);var cache=cm.displ
ay.measureLineCache;var memo={text:line.text,width:cm.display.scroller.clientWid
th,markedSpans:line.markedSpans,measure:measure,classes:line.textClass+"|"+line.
wrapClass};if(cache.length==16)cache[++cm.display.measureLineCachePos%16]=memo;e
lse cache.push(memo);return measure;} |
145 function measureLineInner(cm,line){if(!cm.options.lineWrapping&&line.text.length
>=cm.options.crudeMeasuringFrom) | 146 function measureLineInner(cm,line){if(!cm.options.lineWrapping&&line.text.length
>=cm.options.crudeMeasuringFrom) |
146 return crudelyMeasureLine(cm,line);var display=cm.display,measure=emptyArray(lin
e.text.length);var pre=buildLineContent(cm,line,measure,true).pre;if(ie&&!ie_lt8
&&!cm.options.lineWrapping&&pre.childNodes.length>100){var fragment=document.cre
ateDocumentFragment();var chunk=10,n=pre.childNodes.length;for(var i=0,chunks=Ma
th.ceil(n/chunk);i<chunks;++i){var wrap=elt("div",null,null,"display: inline-blo
ck");for(var j=0;j<chunk&&n;++j){wrap.appendChild(pre.firstChild);--n;} | 147 return crudelyMeasureLine(cm,line);var display=cm.display,measure=emptyArray(lin
e.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,chunk
s=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;} |
147 fragment.appendChild(wrap);} | 148 fragment.appendChild(wrap);} |
148 pre.appendChild(fragment);} | 149 pre.appendChild(fragment);} |
149 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) | 150 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) |
150 removeChildrenAndAdd(display.measure,pre);function measureRect(rect){var top=rec
t.top-outer.top,bot=rect.bottom-outer.top;if(bot>maxBot)bot=maxBot;if(top<0)top=
0;for(var i=vranges.length-2;i>=0;i-=2){var rtop=vranges[i],rbot=vranges[i+1];if
(rtop>bot||rbot<top)continue;if(rtop<=top&&rbot>=bot||top<=rtop&&bot>=rbot||Math
.min(bot,rbot)-Math.max(top,rtop)>=(bot-top)>>1){vranges[i]=Math.min(top,rtop);v
ranges[i+1]=Math.max(bot,rbot);break;}} | 151 removeChildrenAndAdd(display.measure,pre);function measureRect(rect){var top=rec
t.top-outer.top,bot=rect.bottom-outer.top;if(bot>maxBot)bot=maxBot;if(top<0)top=
0;for(var i=vranges.length-2;i>=0;i-=2){var rtop=vranges[i],rbot=vranges[i+1];if
(rtop>bot||rbot<top)continue;if(rtop<=top&&rbot>=bot||top<=rtop&&bot>=rbot||Math
.min(bot,rbot)-Math.max(top,rtop)>=(bot-top)>>1){vranges[i]=Math.min(top,rtop);v
ranges[i+1]=Math.max(bot,rbot);break;}} |
151 if(i<0){i=vranges.length;vranges.push(top,bot);} | 152 if(i<0){i=vranges.length;vranges.push(top,bot);} |
152 return{left:rect.left-outer.left,right:rect.right-outer.left,top:i,bottom:null};
} | 153 return{left:rect.left-outer.left,right:rect.right-outer.left,top:i,bottom:null};
} |
153 function finishRect(rect){rect.bottom=vranges[rect.top+1];rect.top=vranges[rect.
top];} | 154 function finishRect(rect){rect.bottom=vranges[rect.top+1];rect.top=vranges[rect.
top];} |
154 for(var i=0,cur;i<measure.length;++i)if(cur=measure[i]){var node=cur,rect=null;i
f(/\bCodeMirror-widget\b/.test(cur.className)&&cur.getClientRects){if(cur.firstC
hild.nodeType==1)node=cur.firstChild;var rects=node.getClientRects();if(rects.le
ngth>1){rect=data[i]=measureRect(rects[0]);rect.rightSide=measureRect(rects[rect
s.length-1]);}} | 155 for(var i=0,cur;i<measure.length;++i)if(cur=measure[i]){var node=cur,rect=null;i
f(/\bCodeMirror-widget\b/.test(cur.className)&&cur.getClientRects){if(cur.firstC
hild.nodeType==1)node=cur.firstChild;var rects=node.getClientRects();if(rects.le
ngth>1){rect=data[i]=measureRect(rects[0]);rect.rightSide=measureRect(rects[rect
s.length-1]);}} |
155 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));} | 156 if(!rect)rect=data[i]=measureRect(getRect(node));if(cur.measureRight)rect.right=
getRect(cur.measureRight).left-outer.left;if(cur.leftSide)rect.leftSide=measureR
ect(getRect(cur.leftSide));} |
156 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)f
inishRect(cur.rightSide);} | 157 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)f
inishRect(cur.rightSide);} |
157 return data;} | 158 return data;} |
158 function crudelyMeasureLine(cm,line){var copy=new Line(line.text.slice(0,100),nu
ll);if(line.textClass)copy.textClass=line.textClass;var measure=measureLineInner
(cm,copy);var left=measureChar(cm,copy,0,measure,"left");var right=measureChar(c
m,copy,99,measure,"right");return{crude:true,top:left.top,left:left.left,bottom:
left.bottom,width:(right.right-left.left)/100};} | 159 function crudelyMeasureLine(cm,line){var copy=new Line(line.text.slice(0,100),nu
ll);if(line.textClass)copy.textClass=line.textClass;var measure=measureLineInner
(cm,copy);var left=measureChar(cm,copy,0,measure,"left");var right=measureChar(c
m,copy,99,measure,"right");return{crude:true,top:left.top,left:left.left,bottom:
left.bottom,width:(right.right-left.left)/100};} |
159 function measureLineWidth(cm,line){var hasBadSpan=false;if(line.markedSpans)for(
var i=0;i<line.markedSpans;++i){var sp=line.markedSpans[i];if(sp.collapsed&&(sp.
to==null||sp.to==line.text.length))hasBadSpan=true;} | 160 function measureLineWidth(cm,line){var hasBadSpan=false;if(line.markedSpans)for(
var i=0;i<line.markedSpans;++i){var sp=line.markedSpans[i];if(sp.collapsed&&(sp.
to==null||sp.to==line.text.length))hasBadSpan=true;} |
160 var cached=!hasBadSpan&&findCachedMeasurement(cm,line);if(cached||line.text.leng
th>=cm.options.crudeMeasuringFrom) | 161 var cached=!hasBadSpan&&findCachedMeasurement(cm,line);if(cached||line.text.leng
th>=cm.options.crudeMeasuringFrom) |
161 return measureChar(cm,line,line.text.length,cached&&cached.measure,"right").righ
t;var pre=buildLineContent(cm,line,null,true).pre;var end=pre.appendChild(zeroWi
dthElement(cm.display.measure));removeChildrenAndAdd(cm.display.measure,pre);ret
urn getRect(end).right-getRect(cm.display.lineDiv).left;} | 162 return measureChar(cm,line,line.text.length,cached&&cached.measure,"right").righ
t;var pre=buildLineContent(cm,line,null,true).pre;var end=pre.appendChild(zeroWi
dthElement(cm.display.measure));removeChildrenAndAdd(cm.display.measure,pre);ret
urn getRect(end).right-getRect(cm.display.lineDiv).left;} |
162 function clearCaches(cm){cm.display.measureLineCache.length=cm.display.measureLi
neCachePos=0;cm.display.cachedCharWidth=cm.display.cachedTextHeight=null;if(!cm.
options.lineWrapping)cm.display.maxLineChanged=true;cm.display.lineNumChars=null
;} | 163 function clearCaches(cm){cm.display.measureLineCache.length=cm.display.measureLi
neCachePos=0;cm.display.cachedCharWidth=cm.display.cachedTextHeight=null;if(!cm.
options.lineWrapping)cm.display.maxLineChanged=true;cm.display.lineNumChars=null
;} |
163 function pageScrollX(){return window.pageXOffset||(document.documentElement||doc
ument.body).scrollLeft;} | 164 function pageScrollX(){return window.pageXOffset||(document.documentElement||doc
ument.body).scrollLeft;} |
164 function pageScrollY(){return window.pageYOffset||(document.documentElement||doc
ument.body).scrollTop;} | 165 function pageScrollY(){return window.pageYOffset||(document.documentElement||doc
ument.body).scrollTop;} |
165 function intoCoordSystem(cm,lineObj,rect,context){if(lineObj.widgets)for(var i=0
;i<lineObj.widgets.length;++i)if(lineObj.widgets[i].above){var size=widgetHeight
(lineObj.widgets[i]);rect.top+=size;rect.bottom+=size;} | 166 function intoCoordSystem(cm,lineObj,rect,context){if(lineObj.widgets)for(var i=0
;i<lineObj.widgets.length;++i)if(lineObj.widgets[i].above){var size=widgetHeight
(lineObj.widgets[i]);rect.top+=size;rect.bottom+=size;} |
166 if(context=="line")return rect;if(!context)context="local";var yOff=heightAtLine
(cm,lineObj);if(context=="local")yOff+=paddingTop(cm.display);else yOff-=cm.disp
lay.viewOffset;if(context=="page"||context=="window"){var lOff=getRect(cm.displa
y.lineSpace);yOff+=lOff.top+(context=="window"?0:pageScrollY());var xOff=lOff.le
ft+(context=="window"?0:pageScrollX());rect.left+=xOff;rect.right+=xOff;} | 167 if(context=="line")return rect;if(!context)context="local";var yOff=heightAtLine
(cm,lineObj);if(context=="local")yOff+=paddingTop(cm.display);else yOff-=cm.disp
lay.viewOffset;if(context=="page"||context=="window"){var lOff=getRect(cm.displa
y.lineSpace);yOff+=lOff.top+(context=="window"?0:pageScrollY());var xOff=lOff.le
ft+(context=="window"?0:pageScrollX());rect.left+=xOff;rect.right+=xOff;} |
167 rect.top+=yOff;rect.bottom+=yOff;return rect;} | 168 rect.top+=yOff;rect.bottom+=yOff;return rect;} |
168 function fromCoordSystem(cm,coords,context){if(context=="div")return coords;var
left=coords.left,top=coords.top;if(context=="page"){left-=pageScrollX();top-=pag
eScrollY();}else if(context=="local"||!context){var localBox=getRect(cm.display.
sizer);left+=localBox.left;top+=localBox.top;} | 169 function fromCoordSystem(cm,coords,context){if(context=="div")return coords;var
left=coords.left,top=coords.top;if(context=="page"){left-=pageScrollX();top-=pag
eScrollY();}else if(context=="local"||!context){var localBox=getRect(cm.display.
sizer);left+=localBox.left;top+=localBox.top;} |
169 var lineSpaceBox=getRect(cm.display.lineSpace);return{left:left-lineSpaceBox.lef
t,top:top-lineSpaceBox.top};} | 170 var lineSpaceBox=getRect(cm.display.lineSpace);return{left:left-lineSpaceBox.lef
t,top:top-lineSpaceBox.top};} |
170 function charCoords(cm,pos,context,lineObj,bias){if(!lineObj)lineObj=getLine(cm.
doc,pos.line);return intoCoordSystem(cm,lineObj,measureChar(cm,lineObj,pos.ch,nu
ll,bias),context);} | 171 function charCoords(cm,pos,context,lineObj,bias){if(!lineObj)lineObj=getLine(cm.
doc,pos.line);return intoCoordSystem(cm,lineObj,measureChar(cm,lineObj,pos.ch,nu
ll,bias),context);} |
171 function cursorCoords(cm,pos,context,lineObj,measurement){lineObj=lineObj||getLi
ne(cm.doc,pos.line);if(!measurement)measurement=measureLine(cm,lineObj);function
get(ch,right){var m=measureChar(cm,lineObj,ch,measurement,right?"right":"left")
;if(right)m.left=m.right;else m.right=m.left;return intoCoordSystem(cm,lineObj,m
,context);} | 172 function cursorCoords(cm,pos,context,lineObj,measurement){lineObj=lineObj||getLi
ne(cm.doc,pos.line);if(!measurement)measurement=measureLine(cm,lineObj);function
get(ch,right){var m=measureChar(cm,lineObj,ch,measurement,right?"right":"left")
;if(right)m.left=m.right;else m.right=m.left;return intoCoordSystem(cm,lineObj,m
,context);} |
172 function getBidi(ch,partPos){var part=order[partPos],right=part.level%2;if(ch==b
idiLeft(part)&&partPos&&part.level<order[partPos-1].level){part=order[--partPos]
;ch=bidiRight(part)-(part.level%2?0:1);right=true;}else if(ch==bidiRight(part)&&
partPos<order.length-1&&part.level<order[partPos+1].level){part=order[++partPos]
;ch=bidiLeft(part)-part.level%2;right=false;} | 173 function getBidi(ch,partPos){var part=order[partPos],right=part.level%2;if(ch==b
idiLeft(part)&&partPos&&part.level<order[partPos-1].level){part=order[--partPos]
;ch=bidiRight(part)-(part.level%2?0:1);right=true;}else if(ch==bidiRight(part)&&
partPos<order.length-1&&part.level<order[partPos+1].level){part=order[++partPos]
;ch=bidiLeft(part)-part.level%2;right=false;} |
173 if(right&&ch==part.to&&ch>part.from)return get(ch-1);return get(ch,right);} | 174 if(right&&ch==part.to&&ch>part.from)return get(ch-1);return get(ch,right);} |
174 var order=getOrder(lineObj),ch=pos.ch;if(!order)return get(ch);var partPos=getBi
diPartAt(order,ch);var val=getBidi(ch,partPos);if(bidiOther!=null)val.other=getB
idi(ch,bidiOther);return val;} | 175 var order=getOrder(lineObj),ch=pos.ch;if(!order)return get(ch);var partPos=getBi
diPartAt(order,ch);var val=getBidi(ch,partPos);if(bidiOther!=null)val.other=getB
idi(ch,bidiOther);return val;} |
175 function PosWithInfo(line,ch,outside,xRel){var pos=new Pos(line,ch);pos.xRel=xRe
l;if(outside)pos.outside=true;return pos;} | 176 function PosWithInfo(line,ch,outside,xRel){var pos=new Pos(line,ch);pos.xRel=xRe
l;if(outside)pos.outside=true;return pos;} |
176 function coordsChar(cm,x,y){var doc=cm.doc;y+=cm.display.viewOffset;if(y<0)retur
n PosWithInfo(doc.first,0,true,-1);var lineNo=lineAtHeight(doc,y),last=doc.first
+doc.size-1;if(lineNo>last) | 177 function coordsChar(cm,x,y){var doc=cm.doc;y+=cm.display.viewOffset;if(y<0)retur
n PosWithInfo(doc.first,0,true,-1);var lineNo=lineAtHeight(doc,y),last=doc.first
+doc.size-1;if(lineNo>last) |
177 return PosWithInfo(doc.first+doc.size-1,getLine(doc,last).text.length,true,1);if
(x<0)x=0;for(;;){var lineObj=getLine(doc,lineNo);var found=coordsCharInner(cm,li
neObj,lineNo,x,y);var merged=collapsedSpanAtEnd(lineObj);var mergedPos=merged&&m
erged.find();if(merged&&(found.ch>mergedPos.from.ch||found.ch==mergedPos.from.ch
&&found.xRel>0)) | 178 return PosWithInfo(doc.first+doc.size-1,getLine(doc,last).text.length,true,1);if
(x<0)x=0;for(;;){var lineObj=getLine(doc,lineNo);var found=coordsCharInner(cm,li
neObj,lineNo,x,y);var merged=collapsedSpanAtEnd(lineObj);var mergedPos=merged&&m
erged.find();if(merged&&(found.ch>mergedPos.from.ch||found.ch==mergedPos.from.ch
&&found.xRel>0)) |
178 lineNo=mergedPos.to.line;else | 179 lineNo=mergedPos.to.line;else |
179 return found;}} | 180 return found;}} |
180 function coordsCharInner(cm,lineObj,lineNo,x,y){var innerOff=y-heightAtLine(cm,l
ineObj);var wrongLine=false,adjust=2*cm.display.wrapper.clientWidth;var measurem
ent=measureLine(cm,lineObj);function getX(ch){var sp=cursorCoords(cm,Pos(lineNo,
ch),"line",lineObj,measurement);wrongLine=true;if(innerOff>sp.bottom)return sp.l
eft-adjust;else if(innerOff<sp.top)return sp.left+adjust;else wrongLine=false;re
turn sp.left;} | 181 function coordsCharInner(cm,lineObj,lineNo,x,y){var innerOff=y-heightAtLine(cm,l
ineObj);var wrongLine=false,adjust=2*cm.display.wrapper.clientWidth;var measurem
ent=measureLine(cm,lineObj);function getX(ch){var sp=cursorCoords(cm,Pos(lineNo,
ch),"line",lineObj,measurement);wrongLine=true;if(innerOff>sp.bottom)return sp.l
eft-adjust;else if(innerOff<sp.top)return sp.left+adjust;else wrongLine=false;re
turn sp.left;} |
181 var bidi=getOrder(lineObj),dist=lineObj.text.length;var from=lineLeft(lineObj),t
o=lineRight(lineObj);var fromX=getX(from),fromOutside=wrongLine,toX=getX(to),toO
utside=wrongLine;if(x>toX)return PosWithInfo(lineNo,to,toOutside,1);for(;;){if(b
idi?to==from||to==moveVisually(lineObj,from,1):to-from<=1){var ch=x<fromX||x-fro
mX<=toX-x?from:to;var xDiff=x-(ch==from?fromX:toX);while(isExtendingChar.test(li
neObj.text.charAt(ch)))++ch;var pos=PosWithInfo(lineNo,ch,ch==from?fromOutside:t
oOutside,xDiff<0?-1:xDiff?1:0);return pos;} | 182 var bidi=getOrder(lineObj),dist=lineObj.text.length;var from=lineLeft(lineObj),t
o=lineRight(lineObj);var fromX=getX(from),fromOutside=wrongLine,toX=getX(to),toO
utside=wrongLine;if(x>toX)return PosWithInfo(lineNo,to,toOutside,1);for(;;){if(b
idi?to==from||to==moveVisually(lineObj,from,1):to-from<=1){var ch=x<fromX||x-fro
mX<=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:toOuts
ide,xDiff<0?-1:xDiff?1:0);return pos;} |
182 var step=Math.ceil(dist/2),middle=from+step;if(bidi){middle=from;for(var i=0;i<s
tep;++i)middle=moveVisually(lineObj,middle,1);} | 183 var step=Math.ceil(dist/2),middle=from+step;if(bidi){middle=from;for(var i=0;i<s
tep;++i)middle=moveVisually(lineObj,middle,1);} |
183 var middleX=getX(middle);if(middleX>x){to=middle;toX=middleX;if(toOutside=wrongL
ine)toX+=1000;dist=step;} | 184 var middleX=getX(middle);if(middleX>x){to=middle;toX=middleX;if(toOutside=wrongL
ine)toX+=1000;dist=step;} |
184 else{from=middle;fromX=middleX;fromOutside=wrongLine;dist-=step;}}} | 185 else{from=middle;fromX=middleX;fromOutside=wrongLine;dist-=step;}}} |
185 var measureText;function textHeight(display){if(display.cachedTextHeight!=null)r
eturn display.cachedTextHeight;if(measureText==null){measureText=elt("pre");for(
var i=0;i<49;++i){measureText.appendChild(document.createTextNode("x"));measureT
ext.appendChild(elt("br"));} | 186 var measureText;function textHeight(display){if(display.cachedTextHeight!=null)r
eturn display.cachedTextHeight;if(measureText==null){measureText=elt("pre");for(
var i=0;i<49;++i){measureText.appendChild(document.createTextNode("x"));measureT
ext.appendChild(elt("br"));} |
186 measureText.appendChild(document.createTextNode("x"));} | 187 measureText.appendChild(document.createTextNode("x"));} |
187 removeChildrenAndAdd(display.measure,measureText);var height=measureText.offsetH
eight/50;if(height>3)display.cachedTextHeight=height;removeChildren(display.meas
ure);return height||1;} | 188 removeChildrenAndAdd(display.measure,measureText);var height=measureText.offsetH
eight/50;if(height>3)display.cachedTextHeight=height;removeChildren(display.meas
ure);return height||1;} |
188 function charWidth(display){if(display.cachedCharWidth!=null)return display.cach
edCharWidth;var anchor=elt("span","x");var pre=elt("pre",[anchor]);removeChildre
nAndAdd(display.measure,pre);var width=anchor.offsetWidth;if(width>2)display.cac
hedCharWidth=width;return width||10;} | 189 function charWidth(display){if(display.cachedCharWidth!=null)return display.cach
edCharWidth;var anchor=elt("span","x");var pre=elt("pre",[anchor]);removeChildre
nAndAdd(display.measure,pre);var width=anchor.offsetWidth;if(width>2)display.cac
hedCharWidth=width;return width||10;} |
189 var nextOpId=0;function startOperation(cm){cm.curOp={changes:[],forceUpdate:fals
e,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:false,cu
rsorActivity:false,updateMaxLine:false,updateScrollPos:false,id:++nextOpId};if(!
delayedCallbackDepth++)delayedCallbacks=[];} | 190 var nextOpId=0;function startOperation(cm){cm.curOp={changes:[],forceUpdate:fals
e,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:false,cu
rsorActivity:false,updateMaxLine:false,updateScrollPos:false,id:++nextOpId};if(!
delayedCallbackDepth++)delayedCallbacks=[];} |
190 function endOperation(cm){var op=cm.curOp,doc=cm.doc,display=cm.display;cm.curOp
=null;if(op.updateMaxLine)computeMaxLength(cm);if(display.maxLineChanged&&!cm.op
tions.lineWrapping&&display.maxLine){var width=measureLineWidth(cm,display.maxLi
ne);display.sizer.style.minWidth=Math.max(0,width+3+scrollerCutOff)+"px";display
.maxLineChanged=false;var maxScrollLeft=Math.max(0,display.sizer.offsetLeft+disp
lay.sizer.offsetWidth-display.scroller.clientWidth);if(maxScrollLeft<doc.scrollL
eft&&!op.updateScrollPos) | 191 function endOperation(cm){var op=cm.curOp,doc=cm.doc,display=cm.display;cm.curOp
=null;if(op.updateMaxLine)computeMaxLength(cm);if(display.maxLineChanged&&!cm.op
tions.lineWrapping&&display.maxLine){var width=measureLineWidth(cm,display.maxLi
ne);display.sizer.style.minWidth=Math.max(0,width+3+scrollerCutOff)+"px";display
.maxLineChanged=false;var maxScrollLeft=Math.max(0,display.sizer.offsetLeft+disp
lay.sizer.offsetWidth-display.scroller.clientWidth);if(maxScrollLeft<doc.scrollL
eft&&!op.updateScrollPos) |
191 setScrollLeft(cm,Math.min(display.scroller.scrollLeft,maxScrollLeft),true);} | 192 setScrollLeft(cm,Math.min(display.scroller.scrollLeft,maxScrollLeft),true);} |
(...skipping 14 matching lines...) Expand all Loading... |
206 finally{if(withOp)endOperation(this.cm);} | 207 finally{if(withOp)endOperation(this.cm);} |
207 return result;};} | 208 return result;};} |
208 function runInOp(cm,f){var withOp=!cm.curOp,result;if(withOp)startOperation(cm);
try{result=f();} | 209 function runInOp(cm,f){var withOp=!cm.curOp,result;if(withOp)startOperation(cm);
try{result=f();} |
209 finally{if(withOp)endOperation(cm);} | 210 finally{if(withOp)endOperation(cm);} |
210 return result;} | 211 return result;} |
211 function regChange(cm,from,to,lendiff){if(from==null)from=cm.doc.first;if(to==nu
ll)to=cm.doc.first+cm.doc.size;cm.curOp.changes.push({from:from,to:to,diff:lendi
ff});} | 212 function regChange(cm,from,to,lendiff){if(from==null)from=cm.doc.first;if(to==nu
ll)to=cm.doc.first+cm.doc.size;cm.curOp.changes.push({from:from,to:to,diff:lendi
ff});} |
212 function slowPoll(cm){if(cm.display.pollingFast)return;cm.display.poll.set(cm.op
tions.pollInterval,function(){readInput(cm);if(cm.state.focused)slowPoll(cm);});
} | 213 function slowPoll(cm){if(cm.display.pollingFast)return;cm.display.poll.set(cm.op
tions.pollInterval,function(){readInput(cm);if(cm.state.focused)slowPoll(cm);});
} |
213 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);} | 214 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);} |
214 else{cm.display.pollingFast=false;slowPoll(cm);}} | 215 else{cm.display.pollingFast=false;slowPoll(cm);}} |
215 cm.display.poll.set(20,p);} | 216 cm.display.poll.set(20,p);} |
216 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.fakedL
astChar){input.value=input.value.substring(0,input.value.length-1);cm.state.fake
dLastChar=false;} | 217 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.fake
dLastChar){input.value=input.value.substring(0,input.value.length-1);cm.state.fa
kedLastChar=false;} |
217 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 fal
se;} | 218 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 fal
se;} |
218 var withOp=!cm.curOp;if(withOp)startOperation(cm);sel.shift=false;var same=0,l=M
ath.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.lengt
h) | 219 var withOp=!cm.curOp;if(withOp)startOperation(cm);sel.shift=false;var same=0,l=M
ath.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) |
219 from=Pos(from.line,from.ch-(prevInput.length-same));else if(cm.state.overwrite&&
posEq(from,to)&&!cm.state.pasteIncoming) | 220 from=Pos(from.line,from.ch-(prevInput.length-same));else if(cm.state.overwrite&&
posEq(from,to)&&!cm.state.pasteIncoming) |
220 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:s
plitLines(text.slice(same)),origin:cm.state.pasteIncoming?"paste":"+input"};make
Change(cm.doc,changeEvent,"end");cm.curOp.updateInput=updateInput;signalLater(cm
,"inputRead",cm,changeEvent);if(text.length>1000||text.indexOf("\n")>-1)input.va
lue=cm.display.prevInput="";else cm.display.prevInput=text;if(withOp)endOperatio
n(cm);cm.state.pasteIncoming=false;return true;} | 221 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:spli
tLines(inserted),origin:cm.state.pasteIncoming?"paste":cm.state.cutIncoming?"cut
":"+input"};makeChange(cm.doc,changeEvent,"end");cm.curOp.updateInput=updateInpu
t;signalLater(cm,"inputRead",cm,changeEvent);if(inserted&&!cm.state.pasteIncomin
g&&cm.options.electricChars&&cm.options.smartIndent&&sel.head.ch<100){var electr
ic=cm.getModeAt(sel.head).electricChars;if(electric)for(var i=0;i<electric.lengt
h;i++) |
| 222 if(inserted.indexOf(electric.charAt(i))>-1){indentLine(cm,sel.head.line,"smart")
;break;}} |
| 223 if(text.length>1000||text.indexOf("\n")>-1)input.value=cm.display.prevInput="";e
lse cm.display.prevInput=text;if(withOp)endOperation(cm);cm.state.pasteIncoming=
cm.state.cutIncoming=false;return true;} |
221 function resetInput(cm,user){var minimal,selected,doc=cm.doc;if(!posEq(doc.sel.f
rom,doc.sel.to)){cm.display.prevInput="";minimal=hasCopyEvent&&(doc.sel.to.line-
doc.sel.from.line>100||(selected=cm.getSelection()).length>1000);var content=min
imal?"-":selected||cm.getSelection();cm.display.input.value=content;if(cm.state.
focused)selectInput(cm.display.input);if(ie&&!ie_lt9)cm.display.inputHasSelectio
n=content;}else if(user){cm.display.prevInput=cm.display.input.value="";if(ie&&!
ie_lt9)cm.display.inputHasSelection=null;} | 224 function resetInput(cm,user){var minimal,selected,doc=cm.doc;if(!posEq(doc.sel.f
rom,doc.sel.to)){cm.display.prevInput="";minimal=hasCopyEvent&&(doc.sel.to.line-
doc.sel.from.line>100||(selected=cm.getSelection()).length>1000);var content=min
imal?"-":selected||cm.getSelection();cm.display.input.value=content;if(cm.state.
focused)selectInput(cm.display.input);if(ie&&!ie_lt9)cm.display.inputHasSelectio
n=content;}else if(user){cm.display.prevInput=cm.display.input.value="";if(ie&&!
ie_lt9)cm.display.inputHasSelection=null;} |
222 cm.display.inaccurateSelection=minimal;} | 225 cm.display.inaccurateSelection=minimal;} |
223 function focusInput(cm){if(cm.options.readOnly!="nocursor"&&(!mobile||document.a
ctiveElement!=cm.display.input)) | 226 function focusInput(cm){if(cm.options.readOnly!="nocursor"&&(!mobile||document.a
ctiveElement!=cm.display.input)) |
224 cm.display.input.focus();} | 227 cm.display.input.focus();} |
225 function isReadOnly(cm){return cm.options.readOnly||cm.doc.cantEdit;} | 228 function isReadOnly(cm){return cm.options.readOnly||cm.doc.cantEdit;} |
226 function registerEventHandlers(cm){var d=cm.display;on(d.scroller,"mousedown",op
eration(cm,onMouseDown));if(ie) | 229 function registerEventHandlers(cm){var d=cm.display;on(d.scroller,"mousedown",op
eration(cm,onMouseDown));if(old_ie) |
227 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.displ
ay,e))return;e_preventDefault(e);var word=findWordAt(getLine(cm.doc,pos.line).te
xt,pos);extendSelection(cm.doc,word.from,word.to);}));else | 230 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.displ
ay,e))return;e_preventDefault(e);var word=findWordAt(getLine(cm.doc,pos.line).te
xt,pos);extendSelection(cm.doc,word.from,word.to);}));else |
228 on(d.scroller,"dblclick",function(e){signalDOMEvent(cm,e)||e_preventDefault(e);}
);on(d.lineSpace,"selectstart",function(e){if(!eventInWidget(d,e))e_preventDefau
lt(e);});if(!captureMiddleClick)on(d.scroller,"contextmenu",function(e){onContex
tMenu(cm,e);});on(d.scroller,"scroll",function(){if(d.scroller.clientHeight){set
ScrollTop(cm,d.scroller.scrollTop);setScrollLeft(cm,d.scroller.scrollLeft,true);
signal(cm,"scroll",cm);}});on(d.scrollbarV,"scroll",function(){if(d.scroller.cli
entHeight)setScrollTop(cm,d.scrollbarV.scrollTop);});on(d.scrollbarH,"scroll",fu
nction(){if(d.scroller.clientHeight)setScrollLeft(cm,d.scrollbarH.scrollLeft);})
;on(d.scroller,"mousewheel",function(e){onScrollWheel(cm,e);});on(d.scroller,"DO
MMouseScroll",function(e){onScrollWheel(cm,e);});function reFocus(){if(cm.state.
focused)setTimeout(bind(focusInput,cm),0);} | 231 on(d.scroller,"dblclick",function(e){signalDOMEvent(cm,e)||e_preventDefault(e);}
);on(d.lineSpace,"selectstart",function(e){if(!eventInWidget(d,e))e_preventDefau
lt(e);});if(!captureMiddleClick)on(d.scroller,"contextmenu",function(e){onContex
tMenu(cm,e);});on(d.scroller,"scroll",function(){if(d.scroller.clientHeight){set
ScrollTop(cm,d.scroller.scrollTop);setScrollLeft(cm,d.scroller.scrollLeft,true);
signal(cm,"scroll",cm);}});on(d.scrollbarV,"scroll",function(){if(d.scroller.cli
entHeight)setScrollTop(cm,d.scrollbarV.scrollTop);});on(d.scrollbarH,"scroll",fu
nction(){if(d.scroller.clientHeight)setScrollLeft(cm,d.scrollbarH.scrollLeft);})
;on(d.scroller,"mousewheel",function(e){onScrollWheel(cm,e);});on(d.scroller,"DO
MMouseScroll",function(e){onScrollWheel(cm,e);});function reFocus(){if(cm.state.
focused)setTimeout(bind(focusInput,cm),0);} |
229 on(d.scrollbarH,"mousedown",reFocus);on(d.scrollbarV,"mousedown",reFocus);on(d.w
rapper,"scroll",function(){d.wrapper.scrollTop=d.wrapper.scrollLeft=0;});var res
izeTimer;function onResize(){if(resizeTimer==null)resizeTimer=setTimeout(functio
n(){resizeTimer=null;d.cachedCharWidth=d.cachedTextHeight=knownScrollbarWidth=nu
ll;clearCaches(cm);runInOp(cm,bind(regChange,cm));},100);} | 232 on(d.scrollbarH,"mousedown",reFocus);on(d.scrollbarV,"mousedown",reFocus);on(d.w
rapper,"scroll",function(){d.wrapper.scrollTop=d.wrapper.scrollLeft=0;});var res
izeTimer;function onResize(){if(resizeTimer==null)resizeTimer=setTimeout(functio
n(){resizeTimer=null;d.cachedCharWidth=d.cachedTextHeight=knownScrollbarWidth=nu
ll;clearCaches(cm);runInOp(cm,bind(regChange,cm));},100);} |
230 on(window,"resize",onResize);function unregister(){for(var p=d.wrapper.parentNod
e;p&&p!=document.body;p=p.parentNode){} | 233 on(window,"resize",onResize);function unregister(){for(var p=d.wrapper.parentNod
e;p&&p!=document.body;p=p.parentNode){} |
231 if(p)setTimeout(unregister,5000);else off(window,"resize",onResize);} | 234 if(p)setTimeout(unregister,5000);else off(window,"resize",onResize);} |
232 setTimeout(unregister,5000);on(d.input,"keyup",operation(cm,function(e){if(signa
lDOMEvent(cm,e)||cm.options.onKeyEvent&&cm.options.onKeyEvent(cm,addStop(e)))ret
urn;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;fas
tPoll(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.onDragE
vent&&cm.options.onDragEvent(cm,addStop(e)))return;e_stop(e);} | 235 setTimeout(unregister,5000);on(d.input,"keyup",operation(cm,onKeyUp));on(d.input
,"input",function(){if(ie&&!ie_lt9&&cm.display.inputHasSelection)cm.display.inpu
tHasSelection=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);} |
233 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.scrolle
r,"drop",operation(cm,onDrop));} | 236 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.scrolle
r,"drop",operation(cm,onDrop));} |
234 on(d.scroller,"paste",function(e){if(eventInWidget(d,e))return;focusInput(cm);fa
stPoll(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.selec
tionEnd=end;cm.state.fakedLastChar=true;} | 237 on(d.scroller,"paste",function(e){if(eventInWidget(d,e))return;focusInput(cm);fa
stPoll(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.selec
tionEnd=end;cm.state.fakedLastChar=true;} |
235 cm.state.pasteIncoming=true;fastPoll(cm);});function prepareCopy(){if(d.inaccura
teSelection){d.prevInput="";d.inaccurateSelection=false;d.input.value=cm.getSele
ction();selectInput(d.input);}} | 238 cm.state.pasteIncoming=true;fastPoll(cm);});function prepareCopy(e){if(d.inaccur
ateSelection){d.prevInput="";d.inaccurateSelection=false;d.input.value=cm.getSel
ection();selectInput(d.input);} |
| 239 if(e.type=="cut")cm.state.cutIncoming=true;} |
236 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();focusInp
ut(cm);});} | 240 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();focusInp
ut(cm);});} |
237 function eventInWidget(display,e){for(var n=e_target(e);n!=display.wrapper;n=n.p
arentNode){if(!n||n.ignoreEvents||n.parentNode==display.sizer&&n!=display.mover)
return true;}} | 241 function eventInWidget(display,e){for(var n=e_target(e);n!=display.wrapper;n=n.p
arentNode){if(!n||n.ignoreEvents||n.parentNode==display.sizer&&n!=display.mover)
return true;}} |
238 function posFromMouse(cm,e,liberal){var display=cm.display;if(!liberal){var targ
et=e_target(e);if(target==display.scrollbarH||target==display.scrollbarH.firstCh
ild||target==display.scrollbarV||target==display.scrollbarV.firstChild||target==
display.scrollbarFiller||target==display.gutterFiller)return null;} | 242 function posFromMouse(cm,e,liberal){var display=cm.display;if(!liberal){var targ
et=e_target(e);if(target==display.scrollbarH||target==display.scrollbarH.firstCh
ild||target==display.scrollbarV||target==display.scrollbarV.firstChild||target==
display.scrollbarFiller||target==display.gutterFiller)return null;} |
239 var x,y,space=getRect(display.lineSpace);try{x=e.clientX;y=e.clientY;}catch(e){r
eturn null;} | 243 var x,y,space=getRect(display.lineSpace);try{x=e.clientX;y=e.clientY;}catch(e){r
eturn null;} |
240 return coordsChar(cm,x-space.left,y-space.top);} | 244 return coordsChar(cm,x-space.left,y-space.top);} |
241 var lastClick,lastDoubleClick;function onMouseDown(e){if(signalDOMEvent(this,e))
return;var cm=this,display=cm.display,doc=cm.doc,sel=doc.sel;sel.shift=e.shiftKe
y;if(eventInWidget(display,e)){if(!webkit){display.scroller.draggable=false;setT
imeout(function(){display.scroller.draggable=true;},100);} | 245 var lastClick,lastDoubleClick;function onMouseDown(e){if(signalDOMEvent(this,e))
return;var cm=this,display=cm.display,doc=cm.doc,sel=doc.sel;sel.shift=e.shiftKe
y;if(eventInWidget(display,e)){if(!webkit){display.scroller.draggable=false;setT
imeout(function(){display.scroller.draggable=true;},100);} |
242 return;} | 246 return;} |
243 if(clickInGutter(cm,e))return;var start=posFromMouse(cm,e);switch(e_button(e)){c
ase 3:if(captureMiddleClick)onContextMenu.call(cm,cm,e);return;case 2:if(webkit)
cm.state.lastMiddleDown=+new Date;if(start)extendSelection(cm.doc,start);setTime
out(bind(focusInput,cm),20);e_preventDefault(e);return;} | 247 if(clickInGutter(cm,e))return;var start=posFromMouse(cm,e);switch(e_button(e)){c
ase 3:if(captureMiddleClick)onContextMenu.call(cm,cm,e);return;case 2:if(webkit)
cm.state.lastMiddleDown=+new Date;if(start)extendSelection(cm.doc,start);setTime
out(bind(focusInput,cm),20);e_preventDefault(e);return;} |
244 if(!start){if(e_target(e)==display.scroller)e_preventDefault(e);return;} | 248 if(!start){if(e_target(e)==display.scroller)e_preventDefault(e);return;} |
245 if(!cm.state.focused)onFocus(cm);var now=+new Date,type="single";if(lastDoubleCl
ick&&lastDoubleClick.time>now-400&&posEq(lastDoubleClick.pos,start)){type="tripl
e";e_preventDefault(e);setTimeout(bind(focusInput,cm),20);selectLine(cm,start.li
ne);}else if(lastClick&&lastClick.time>now-400&&posEq(lastClick.pos,start)){type
="double";lastDoubleClick={time:now,pos:start};e_preventDefault(e);var word=find
WordAt(getLine(doc,start.line).text,start);extendSelection(cm.doc,word.from,word
.to);}else{lastClick={time:now,pos:start};} | 249 if(!cm.state.focused)onFocus(cm);var now=+new Date,type="single";if(lastDoubleCl
ick&&lastDoubleClick.time>now-400&&posEq(lastDoubleClick.pos,start)){type="tripl
e";e_preventDefault(e);setTimeout(bind(focusInput,cm),20);selectLine(cm,start.li
ne);}else if(lastClick&&lastClick.time>now-400&&posEq(lastClick.pos,start)){type
="double";lastDoubleClick={time:now,pos:start};e_preventDefault(e);var word=find
WordAt(getLine(doc,start.line).text,start);extendSelection(cm.doc,word.from,word
.to);}else{lastClick={time:now,pos:start};} |
246 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.scrolle
r,"drop",dragEnd);if(Math.abs(e.clientX-e2.clientX)+Math.abs(e.clientY-e2.client
Y)<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;} | 250 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.scrolle
r,"drop",dragEnd);if(Math.abs(e.clientX-e2.clientX)+Math.abs(e.clientY-e2.client
Y)<10){e_preventDefault(e2);extendSelection(cm.doc,start);focusInput(cm);if(old_
ie&&!ie_lt9) |
| 251 setTimeout(function(){document.body.focus();focusInput(cm);},20);}});if(webkit)d
isplay.scroller.draggable=true;cm.state.draggingText=dragEnd;if(display.scroller
.dragDrop)display.scroller.dragDrop();on(document,"mouseup",dragEnd);on(display.
scroller,"drop",dragEnd);return;} |
247 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;} | 252 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;} |
248 startstart=clipPos(doc,startstart);startend=clipPos(doc,startend);if(type=="doub
le"){var word=findWordAt(getLine(doc,cur.line).text,cur);if(posLess(cur,startsta
rt))extendSelection(cm.doc,word.from,startend);else extendSelection(cm.doc,start
start,word.to);}else if(type=="triple"){if(posLess(cur,startstart))extendSelecti
on(cm.doc,startend,clipPos(doc,Pos(cur.line,0)));else extendSelection(cm.doc,sta
rtstart,clipPos(doc,Pos(cur.line+1,0)));}} | 253 startstart=clipPos(doc,startstart);startend=clipPos(doc,startend);if(type=="doub
le"){var word=findWordAt(getLine(doc,cur.line).text,cur);if(posLess(cur,startsta
rt))extendSelection(cm.doc,word.from,startend);else extendSelection(cm.doc,start
start,word.to);}else if(type=="triple"){if(posLess(cur,startstart))extendSelecti
on(cm.doc,startend,clipPos(doc,Pos(cur.line,0)));else extendSelection(cm.doc,sta
rtstart,clipPos(doc,Pos(cur.line+1,0)));}} |
249 var editorSize=getRect(display.wrapper);var counter=0;function extend(e){var cur
Count=++counter;var cur=posFromMouse(cm,e,true);if(!cur)return;if(!posEq(cur,las
t)){if(!cm.state.focused)onFocus(cm);last=cur;doSelect(cur);var visible=visibleL
ines(display,doc);if(cur.line>=visible.to||cur.line<visible.from) | 254 var editorSize=getRect(display.wrapper);var counter=0;function extend(e){var cur
Count=++counter;var cur=posFromMouse(cm,e,true);if(!cur)return;if(!posEq(cur,las
t)){if(!cm.state.focused)onFocus(cm);last=cur;doSelect(cur);var visible=visibleL
ines(display,doc);if(cur.line>=visible.to||cur.line<visible.from) |
250 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(out
side)setTimeout(operation(cm,function(){if(counter!=curCount)return;display.scro
ller.scrollTop+=outside;extend(e);}),50);}} | 255 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(out
side)setTimeout(operation(cm,function(){if(counter!=curCount)return;display.scro
ller.scrollTop+=outside;extend(e);}),50);}} |
251 function done(e){counter=Infinity;e_preventDefault(e);focusInput(cm);off(documen
t,"mousemove",move);off(document,"mouseup",up);} | 256 function done(e){counter=Infinity;e_preventDefault(e);focusInput(cm);off(documen
t,"mousemove",move);off(document,"mouseup",up);} |
252 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",u
p);} | 257 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,"mouseu
p",up);} |
253 function gutterEvent(cm,e,type,prevent,signalfn){try{var mX=e.clientX,mY=e.clien
tY;} | 258 function gutterEvent(cm,e,type,prevent,signalfn){try{var mX=e.clientX,mY=e.clien
tY;} |
254 catch(e){return false;} | 259 catch(e){return false;} |
255 if(mX>=Math.floor(getRect(cm.display.gutters).right))return false;if(prevent)e_p
reventDefault(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=displ
ay.gutters.childNodes[i];if(g&&getRect(g).right>=mX){var line=lineAtHeight(cm.do
c,mY);var gutter=cm.options.gutters[i];signalfn(cm,type,cm,line,gutter,e);return
e_defaultPrevented(e);}}} | 260 if(mX>=Math.floor(getRect(cm.display.gutters).right))return false;if(prevent)e_p
reventDefault(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=displ
ay.gutters.childNodes[i];if(g&&getRect(g).right>=mX){var line=lineAtHeight(cm.do
c,mY);var gutter=cm.options.gutters[i];signalfn(cm,type,cm,line,gutter,e);return
e_defaultPrevented(e);}}} |
256 function contextMenuInGutter(cm,e){if(!hasHandler(cm,"gutterContextMenu"))return
false;return gutterEvent(cm,e,"gutterContextMenu",false,signal);} | 261 function contextMenuInGutter(cm,e){if(!hasHandler(cm,"gutterContextMenu"))return
false;return gutterEvent(cm,e,"gutterContextMenu",false,signal);} |
257 function clickInGutter(cm,e){return gutterEvent(cm,e,"gutterClick",true,signalLa
ter);} | 262 function clickInGutter(cm,e){return gutterEvent(cm,e,"gutterClick",true,signalLa
ter);} |
258 var lastDrop=0;function onDrop(e){var cm=this;if(signalDOMEvent(cm,e)||eventInWi
dget(cm.display,e)||(cm.options.onDragEvent&&cm.options.onDragEvent(cm,addStop(e
)))) | 263 var lastDrop=0;function onDrop(e){var cm=this;if(signalDOMEvent(cm,e)||eventInWi
dget(cm.display,e)||(cm.options.onDragEvent&&cm.options.onDragEvent(cm,addStop(e
)))) |
259 return;e_preventDefault(e);if(ie)lastDrop=+new Date;var pos=posFromMouse(cm,e,tr
ue),files=e.dataTransfer.files;if(!pos||isReadOnly(cm))return;if(files&&files.le
ngth&&window.FileReader&&window.File){var n=files.length,text=Array(n),read=0;va
r loadFile=function(file,i){var reader=new FileReader;reader.onload=function(){t
ext[i]=reader.result;if(++read==n){pos=clipPos(cm.doc,pos);makeChange(cm.doc,{fr
om:pos,to:pos,text:splitLines(text.join("\n")),origin:"paste"},"around");}};read
er.readAsText(file);};for(var i=0;i<n;++i)loadFile(files[i],i);}else{if(cm.state
.draggingText&&!(posLess(pos,cm.doc.sel.from)||posLess(cm.doc.sel.to,pos))){cm.s
tate.draggingText(e);setTimeout(bind(focusInput,cm),20);return;} | 264 return;e_preventDefault(e);if(ie)lastDrop=+new Date;var pos=posFromMouse(cm,e,tr
ue),files=e.dataTransfer.files;if(!pos||isReadOnly(cm))return;if(files&&files.le
ngth&&window.FileReader&&window.File){var n=files.length,text=Array(n),read=0;va
r loadFile=function(file,i){var reader=new FileReader;reader.onload=function(){t
ext[i]=reader.result;if(++read==n){pos=clipPos(cm.doc,pos);makeChange(cm.doc,{fr
om:pos,to:pos,text:splitLines(text.join("\n")),origin:"paste"},"around");}};read
er.readAsText(file);};for(var i=0;i<n;++i)loadFile(files[i],i);}else{if(cm.state
.draggingText&&!(posLess(pos,cm.doc.sel.from)||posLess(cm.doc.sel.to,pos))){cm.s
tate.draggingText(e);setTimeout(bind(focusInput,cm),20);return;} |
260 try{var text=e.dataTransfer.getData("Text");if(text){var curFrom=cm.doc.sel.from
,curTo=cm.doc.sel.to;setSelection(cm.doc,pos,pos);if(cm.state.draggingText)repla
ceRange(cm.doc,"",curFrom,curTo,"paste");cm.replaceSelection(text,null,"paste");
focusInput(cm);}} | 265 try{var text=e.dataTransfer.getData("Text");if(text){var curFrom=cm.doc.sel.from
,curTo=cm.doc.sel.to;setSelection(cm.doc,pos,pos);if(cm.state.draggingText)repla
ceRange(cm.doc,"",curFrom,curTo,"paste");cm.replaceSelection(text,null,"paste");
focusInput(cm);}} |
261 catch(e){}}} | 266 catch(e){}}} |
262 function onDragStart(cm,e){if(ie&&(!cm.state.draggingText||+new Date-lastDrop<10
0)){e_stop(e);return;} | 267 function onDragStart(cm,e){if(ie&&(!cm.state.draggingText||+new Date-lastDrop<10
0)){e_stop(e);return;} |
263 if(signalDOMEvent(cm,e)||eventInWidget(cm.display,e))return;var txt=cm.getSelect
ion();e.dataTransfer.setData("Text",txt);if(e.dataTransfer.setDragImage&&!safari
){var img=elt("img",null,null,"position: fixed; left: 0; top: 0;");img.src="data
:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";if(opera
){img.width=img.height=1;cm.display.wrapper.appendChild(img);img._top=img.offset
Top;} | 268 if(signalDOMEvent(cm,e)||eventInWidget(cm.display,e))return;var txt=cm.getSelect
ion();e.dataTransfer.setData("Text",txt);if(e.dataTransfer.setDragImage&&!safari
){var img=elt("img",null,null,"position: fixed; left: 0; top: 0;");img.src="data
:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";if(opera
){img.width=img.height=1;cm.display.wrapper.appendChild(img);img._top=img.offset
Top;} |
264 e.dataTransfer.setDragImage(img,0,0);if(opera)img.parentNode.removeChild(img);}} | 269 e.dataTransfer.setDragImage(img,0,0);if(opera)img.parentNode.removeChild(img);}} |
265 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.scrollTo
p!=val)cm.display.scroller.scrollTop=val;if(cm.display.scrollbarV.scrollTop!=val
)cm.display.scrollbarV.scrollTop=val;if(gecko)updateDisplay(cm,[]);startWorker(c
m,100);} | 270 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.scrollTo
p!=val)cm.display.scroller.scrollTop=val;if(cm.display.scrollbarV.scrollTop!=val
)cm.display.scrollbarV.scrollTop=val;if(gecko)updateDisplay(cm,[]);startWorker(c
m,100);} |
266 function setScrollLeft(cm,val,isScroller){if(isScroller?val==cm.doc.scrollLeft:M
ath.abs(cm.doc.scrollLeft-val)<2)return;val=Math.min(val,cm.display.scroller.scr
ollWidth-cm.display.scroller.clientWidth);cm.doc.scrollLeft=val;alignHorizontall
y(cm);if(cm.display.scroller.scrollLeft!=val)cm.display.scroller.scrollLeft=val;
if(cm.display.scrollbarH.scrollLeft!=val)cm.display.scrollbarH.scrollLeft=val;} | 271 function setScrollLeft(cm,val,isScroller){if(isScroller?val==cm.doc.scrollLeft:M
ath.abs(cm.doc.scrollLeft-val)<2)return;val=Math.min(val,cm.display.scroller.scr
ollWidth-cm.display.scroller.clientWidth);cm.doc.scrollLeft=val;alignHorizontall
y(cm);if(cm.display.scroller.scrollLeft!=val)cm.display.scroller.scrollLeft=val;
if(cm.display.scrollbarH.scrollLeft!=val)cm.display.scrollbarH.scrollLeft=val;} |
267 var wheelSamples=0,wheelPixelsPerUnit=null;if(ie)wheelPixelsPerUnit=-.53;else if
(gecko)wheelPixelsPerUnit=15;else if(chrome)wheelPixelsPerUnit=-.7;else if(safar
i)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.wheel
Delta;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;}}} | 272 var wheelSamples=0,wheelPixelsPerUnit=null;if(old_ie)wheelPixelsPerUnit=-.53;els
e if(gecko)wheelPixelsPerUnit=15;else if(chrome)wheelPixelsPerUnit=-.7;else if(s
afari)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.w
heelDelta;var display=cm.display,scroll=display.scroller;if(!(dx&&scroll.scrollW
idth>scroll.clientWidth||dy&&scroll.scrollHeight>scroll.clientHeight))return;if(
dy&&mac&&webkit){for(var cur=e.target;cur!=scroll;cur=cur.parentNode){if(cur.lin
eObj){cm.display.currentWheelTarget=cur;break;}}} |
268 if(dx&&!gecko&&!opera&&wheelPixelsPerUnit!=null){if(dy) | 273 if(dx&&!gecko&&!opera&&wheelPixelsPerUnit!=null){if(dy) |
269 setScrollTop(cm,Math.max(0,Math.min(scroll.scrollTop+dy*wheelPixelsPerUnit,scrol
l.scrollHeight-scroll.clientHeight)));setScrollLeft(cm,Math.max(0,Math.min(scrol
l.scrollLeft+dx*wheelPixelsPerUnit,scroll.scrollWidth-scroll.clientWidth)));e_pr
eventDefault(e);display.wheelStartX=null;return;} | 274 setScrollTop(cm,Math.max(0,Math.min(scroll.scrollTop+dy*wheelPixelsPerUnit,scrol
l.scrollHeight-scroll.clientHeight)));setScrollLeft(cm,Math.max(0,Math.min(scrol
l.scrollLeft+dx*wheelPixelsPerUnit,scroll.scrollWidth-scroll.clientWidth)));e_pr
eventDefault(e);display.wheelStartX=null;return;} |
270 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+p
ixels-50);else bot=Math.min(cm.doc.height,bot+pixels+50);updateDisplay(cm,[],{to
p:top,bottom:bot});} | 275 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+p
ixels-50);else bot=Math.min(cm.doc.height,bot+pixels+50);updateDisplay(cm,[],{to
p:top,bottom:bot});} |
271 if(wheelSamples<20){if(display.wheelStartX==null){display.wheelStartX=scroll.scr
ollLeft;display.wheelStartY=scroll.scrollTop;display.wheelDX=dx;display.wheelDY=
dy;setTimeout(function(){if(display.wheelStartX==null)return;var movedX=scroll.s
crollLeft-display.wheelStartX;var movedY=scroll.scrollTop-display.wheelStartY;va
r sample=(movedY&&display.wheelDY&&movedY/display.wheelDY)||(movedX&&display.whe
elDX&&movedX/display.wheelDX);display.wheelStartX=display.wheelStartY=null;if(!s
ample)return;wheelPixelsPerUnit=(wheelPixelsPerUnit*wheelSamples+sample)/(wheelS
amples+1);++wheelSamples;},200);}else{display.wheelDX+=dx;display.wheelDY+=dy;}}
} | 276 if(wheelSamples<20){if(display.wheelStartX==null){display.wheelStartX=scroll.scr
ollLeft;display.wheelStartY=scroll.scrollTop;display.wheelDX=dx;display.wheelDY=
dy;setTimeout(function(){if(display.wheelStartX==null)return;var movedX=scroll.s
crollLeft-display.wheelStartX;var movedY=scroll.scrollTop-display.wheelStartY;va
r sample=(movedY&&display.wheelDY&&movedY/display.wheelDY)||(movedX&&display.whe
elDX&&movedX/display.wheelDX);display.wheelStartX=display.wheelStartY=null;if(!s
ample)return;wheelPixelsPerUnit=(wheelPixelsPerUnit*wheelSamples+sample)/(wheelS
amples+1);++wheelSamples;},200);}else{display.wheelDX+=dx;display.wheelDY+=dy;}}
} |
272 function doHandleBinding(cm,bound,dropShift){if(typeof bound=="string"){bound=co
mmands[bound];if(!bound)return false;} | 277 function doHandleBinding(cm,bound,dropShift){if(typeof bound=="string"){bound=co
mmands[bound];if(!bound)return false;} |
273 if(cm.display.pollingFast&&readInput(cm))cm.display.pollingFast=false;var doc=cm
.doc,prevShift=doc.sel.shift,done=false;try{if(isReadOnly(cm))cm.state.suppressE
dits=true;if(dropShift)doc.sel.shift=false;done=bound(cm)!=Pass;}finally{doc.sel
.shift=prevShift;cm.state.suppressEdits=false;} | 278 if(cm.display.pollingFast&&readInput(cm))cm.display.pollingFast=false;var doc=cm
.doc,prevShift=doc.sel.shift,done=false;try{if(isReadOnly(cm))cm.state.suppressE
dits=true;if(dropShift)doc.sel.shift=false;done=bound(cm)!=Pass;}finally{doc.sel
.shift=prevShift;cm.state.suppressEdits=false;} |
274 return done;} | 279 return done;} |
275 function allKeyMaps(cm){var maps=cm.state.keyMaps.slice(0);if(cm.options.extraKe
ys)maps.push(cm.options.extraKeys);maps.push(cm.options.keyMap);return maps;} | 280 function allKeyMaps(cm){var maps=cm.state.keyMaps.slice(0);if(cm.options.extraKe
ys)maps.push(cm.options.extraKeys);maps.push(cm.options.keyMap);return maps;} |
276 var maybeTransition;function handleKeyBinding(cm,e){var startMap=getKeyMap(cm.op
tions.keyMap),next=startMap.auto;clearTimeout(maybeTransition);if(next&&!isModif
ierKey(e))maybeTransition=setTimeout(function(){if(getKeyMap(cm.options.keyMap)=
=startMap){cm.options.keyMap=(next.call?next.call(null,cm):next);keyMapChanged(c
m);}},50);var name=keyName(e,true),handled=false;if(!name)return false;var keyma
ps=allKeyMaps(cm);if(e.shiftKey){handled=lookupKey("Shift-"+name,keymaps,functio
n(b){return doHandleBinding(cm,b,true);})||lookupKey(name,keymaps,function(b){if
(typeof b=="string"?/^go[A-Z]/.test(b):b.motion) | 281 var maybeTransition;function handleKeyBinding(cm,e){var startMap=getKeyMap(cm.op
tions.keyMap),next=startMap.auto;clearTimeout(maybeTransition);if(next&&!isModif
ierKey(e))maybeTransition=setTimeout(function(){if(getKeyMap(cm.options.keyMap)=
=startMap){cm.options.keyMap=(next.call?next.call(null,cm):next);keyMapChanged(c
m);}},50);var name=keyName(e,true),handled=false;if(!name)return false;var keyma
ps=allKeyMaps(cm);if(e.shiftKey){handled=lookupKey("Shift-"+name,keymaps,functio
n(b){return doHandleBinding(cm,b,true);})||lookupKey(name,keymaps,function(b){if
(typeof b=="string"?/^go[A-Z]/.test(b):b.motion) |
277 return doHandleBinding(cm,b);});}else{handled=lookupKey(name,keymaps,function(b)
{return doHandleBinding(cm,b);});} | 282 return doHandleBinding(cm,b);});}else{handled=lookupKey(name,keymaps,function(b)
{return doHandleBinding(cm,b);});} |
278 if(handled){e_preventDefault(e);restartBlink(cm);if(ie_lt9){e.oldKeyCode=e.keyCo
de;e.keyCode=0;} | 283 if(handled){e_preventDefault(e);restartBlink(cm);if(ie_lt9){e.oldKeyCode=e.keyCo
de;e.keyCode=0;} |
279 signalLater(cm,"keyHandled",cm,name,e);} | 284 signalLater(cm,"keyHandled",cm,name,e);} |
280 return handled;} | 285 return handled;} |
281 function handleCharBinding(cm,e,ch){var handled=lookupKey("'"+ch+"'",allKeyMaps(
cm),function(b){return doHandleBinding(cm,b,true);});if(handled){e_preventDefaul
t(e);restartBlink(cm);signalLater(cm,"keyHandled",cm,"'"+ch+"'",e);} | 286 function handleCharBinding(cm,e,ch){var handled=lookupKey("'"+ch+"'",allKeyMaps(
cm),function(b){return doHandleBinding(cm,b,true);});if(handled){e_preventDefaul
t(e);restartBlink(cm);signalLater(cm,"keyHandled",cm,"'"+ch+"'",e);} |
282 return handled;} | 287 return handled;} |
283 var lastStoppedKey=null;function onKeyDown(e){var cm=this;if(!cm.state.focused)o
nFocus(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.keyCo
de;cm.doc.sel.shift=code==16||e.shiftKey;var handled=handleKeyBinding(cm,e);if(o
pera){lastStoppedKey=handled?code:null;if(!handled&&code==88&&!hasCopyEvent&&(ma
c?e.metaKey:e.ctrlKey)) | 288 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=fa
lse;} |
| 289 var lastStoppedKey=null;function onKeyDown(e){var cm=this;if(!cm.state.focused)o
nFocus(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.k
eyCode;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)) |
284 cm.replaceSelection("");}} | 290 cm.replaceSelection("");}} |
285 function onKeyPress(e){var cm=this;if(signalDOMEvent(cm,e)||cm.options.onKeyEven
t&&cm.options.onKeyEvent(cm,addStop(e)))return;var keyCode=e.keyCode,charCode=e.
charCode;if(opera&&keyCode==lastStoppedKey){lastStoppedKey=null;e_preventDefault
(e);return;} | 291 function onKeyPress(e){var cm=this;if(signalDOMEvent(cm,e)||cm.options.onKeyEven
t&&cm.options.onKeyEvent(cm,addStop(e)))return;var keyCode=e.keyCode,charCode=e.
charCode;if(opera&&keyCode==lastStoppedKey){lastStoppedKey=null;e_preventDefault
(e);return;} |
286 if(((opera&&(!e.which||e.which<10))||khtml)&&handleKeyBinding(cm,e))return;var c
h=String.fromCharCode(charCode==null?keyCode:charCode);if(this.options.electricC
hars&&this.doc.mode.electricChars&&this.options.smartIndent&&!isReadOnly(this)&&
this.doc.mode.electricChars.indexOf(ch)>-1) | 292 if(((opera&&(!e.which||e.which<10))||khtml)&&handleKeyBinding(cm,e))return;var c
h=String.fromCharCode(charCode==null?keyCode:charCode);if(handleCharBinding(cm,e
,ch))return;if(ie&&!ie_lt9)cm.display.inputHasSelection=null;fastPoll(cm);} |
287 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.inputHasSelec
tion=null;fastPoll(cm);} | |
288 function onFocus(cm){if(cm.options.readOnly=="nocursor")return;if(!cm.state.focu
sed){signal(cm,"focus",cm);cm.state.focused=true;if(cm.display.wrapper.className
.search(/\bCodeMirror-focused\b/)==-1) | 293 function onFocus(cm){if(cm.options.readOnly=="nocursor")return;if(!cm.state.focu
sed){signal(cm,"focus",cm);cm.state.focused=true;if(cm.display.wrapper.className
.search(/\bCodeMirror-focused\b/)==-1) |
289 cm.display.wrapper.className+=" CodeMirror-focused";if(!cm.curOp){resetInput(cm,
true);if(webkit)setTimeout(bind(resetInput,cm,true),0);}} | 294 cm.display.wrapper.className+=" CodeMirror-focused";if(!cm.curOp){resetInput(cm,
true);if(webkit)setTimeout(bind(resetInput,cm,true),0);}} |
290 slowPoll(cm);restartBlink(cm);} | 295 slowPoll(cm);restartBlink(cm);} |
291 function onBlur(cm){if(cm.state.focused){signal(cm,"blur",cm);cm.state.focused=f
alse;cm.display.wrapper.className=cm.display.wrapper.className.replace(" CodeMir
ror-focused","");} | 296 function onBlur(cm){if(cm.state.focused){signal(cm,"blur",cm);cm.state.focused=f
alse;cm.display.wrapper.className=cm.display.wrapper.className.replace(" CodeMir
ror-focused","");} |
292 clearInterval(cm.display.blinker);setTimeout(function(){if(!cm.state.focused)cm.
doc.sel.shift=false;},150);} | 297 clearInterval(cm.display.blinker);setTimeout(function(){if(!cm.state.focused)cm.
doc.sel.shift=false;},150);} |
293 var detectingSelectAll;function onContextMenu(cm,e){if(signalDOMEvent(cm,e,"cont
extmenu"))return;var display=cm.display,sel=cm.doc.sel;if(eventInWidget(display,
e)||contextMenuInGutter(cm,e))return;var pos=posFromMouse(cm,e),scrollPos=displa
y.scroller.scrollTop;if(!pos||opera)return;var reset=cm.options.resetSelectionOn
ContextMenu;if(reset&&(posEq(sel.from,sel.to)||posLess(pos,sel.from)||!posLess(p
os,sel.to))) | 298 var detectingSelectAll;function onContextMenu(cm,e){if(signalDOMEvent(cm,e,"cont
extmenu"))return;var display=cm.display,sel=cm.doc.sel;if(eventInWidget(display,
e)||contextMenuInGutter(cm,e))return;var pos=posFromMouse(cm,e),scrollPos=displa
y.scroller.scrollTop;if(!pos||opera)return;var reset=cm.options.resetSelectionOn
ContextMenu;if(reset&&(posEq(sel.from,sel.to)||posLess(pos,sel.from)||!posLess(p
os,sel.to))) |
294 operation(cm,setSelection)(cm.doc,pos,pos);var oldCSS=display.input.style.cssTex
t;display.inputDiv.style.position="absolute";display.input.style.cssText="positi
on: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clien
tX-5)+"px; z-index: 1000; background: white; outline: none;"+"border-width: 0; o
utline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(op
acity=5);";focusInput(cm);resetInput(cm,true);if(posEq(sel.from,sel.to))display.
input.value=display.prevInput=" ";function prepareSelectAllHack(){if(display.inp
ut.selectionStart!=null){var extval=display.input.value="\u200b"+(posEq(sel.from
,sel.to)?"":display.input.value);display.prevInput="\u200b";display.input.select
ionStart=1;display.input.selectionEnd=extval.length;}} | 299 operation(cm,setSelection)(cm.doc,pos,pos);var oldCSS=display.input.style.cssTex
t;display.inputDiv.style.position="absolute";display.input.style.cssText="positi
on: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clien
tX-5)+"px; z-index: 1000; background: transparent; outline: none;"+"border-width
: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: al
pha(opacity=5);";focusInput(cm);resetInput(cm,true);if(posEq(sel.from,sel.to))di
splay.input.value=display.prevInput=" ";function prepareSelectAllHack(){if(displ
ay.input.selectionStart!=null){var extval=display.input.value="\u200b"+(posEq(se
l.from,sel.to)?"":display.input.value);display.prevInput="\u200b";display.input.
selectionStart=1;display.input.selectionEnd=extval.length;}} |
295 function rehide(){display.inputDiv.style.position="relative";display.input.style
.cssText=oldCSS;if(ie_lt9)display.scrollbarV.scrollTop=display.scroller.scrollTo
p=scrollPos;slowPoll(cm);if(display.input.selectionStart!=null){if(!ie||ie_lt9)p
repareSelectAllHack();clearTimeout(detectingSelectAll);var i=0,poll=function(){i
f(display.prevInput==" "&&display.input.selectionStart==0) | 300 function rehide(){display.inputDiv.style.position="relative";display.input.style
.cssText=oldCSS;if(ie_lt9)display.scrollbarV.scrollTop=display.scroller.scrollTo
p=scrollPos;slowPoll(cm);if(display.input.selectionStart!=null){if(!old_ie||ie_l
t9)prepareSelectAllHack();clearTimeout(detectingSelectAll);var i=0,poll=function
(){if(display.prevInput=="\u200b"&&display.input.selectionStart==0) |
296 operation(cm,commands.selectAll)(cm);else if(i++<10)detectingSelectAll=setTimeou
t(poll,500);else resetInput(cm);};detectingSelectAll=setTimeout(poll,200);}} | 301 operation(cm,commands.selectAll)(cm);else if(i++<10)detectingSelectAll=setTimeou
t(poll,500);else resetInput(cm);};detectingSelectAll=setTimeout(poll,200);}} |
297 if(ie&&!ie_lt9)prepareSelectAllHack();if(captureMiddleClick){e_stop(e);var mouse
up=function(){off(window,"mouseup",mouseup);setTimeout(rehide,20);};on(window,"m
ouseup",mouseup);}else{setTimeout(rehide,50);}} | 302 if(old_ie&&!ie_lt9)prepareSelectAllHack();if(captureMiddleClick){e_stop(e);var m
ouseup=function(){off(window,"mouseup",mouseup);setTimeout(rehide,20);};on(windo
w,"mouseup",mouseup);}else{setTimeout(rehide,50);}} |
298 var changeEnd=CodeMirror.changeEnd=function(change){if(!change.text)return chang
e.to;return Pos(change.from.line+change.text.length-1,lst(change.text).length+(c
hange.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.len
gth-1)-(change.to.line-change.from.line);if(pos.line>change.to.line+diff){var pr
eLine=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,pr
eLine).text.length);} | 303 var changeEnd=CodeMirror.changeEnd=function(change){if(!change.text)return chang
e.to;return Pos(change.from.line+change.text.length-1,lst(change.text).length+(c
hange.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.len
gth-1)-(change.to.line-change.from.line);if(pos.line>change.to.line+diff){var pr
eLine=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,pr
eLine).text.length);} |
299 if(pos.line==change.to.line+diff) | 304 if(pos.line==change.to.line+diff) |
300 return clipToLen(pos,lst(change.text).length+(change.text.length==1?change.from.
ch:0)+ | 305 return clipToLen(pos,lst(change.text).length+(change.text.length==1?change.from.
ch:0)+ |
301 getLine(doc,change.to.line).text.length-change.to.ch);var inside=pos.line-change
.from.line;return clipToLen(pos,change.text[inside].length+(inside?0:change.from
.ch));} | 306 getLine(doc,change.to.line).text.length-change.to.ch);var inside=pos.line-change
.from.line;return clipToLen(pos,change.text[inside].length+(inside?0:change.from
.ch));} |
302 function computeSelAfterChange(doc,change,hint){if(hint&&typeof hint=="object") | 307 function computeSelAfterChange(doc,change,hint){if(hint&&typeof hint=="object") |
303 return{anchor:clipPostChange(doc,change,hint.anchor),head:clipPostChange(doc,cha
nge,hint.head)};if(hint=="start")return{anchor:change.from,head:change.from};var
end=changeEnd(change);if(hint=="around")return{anchor:change.from,head:end};if(
hint=="end")return{anchor:end,head:end};var adjustPos=function(pos){if(posLess(p
os,change.from))return pos;if(!posLess(change.to,pos))return end;var line=pos.li
ne+change.text.length-(change.to.line-change.from.line)-1,ch=pos.ch;if(pos.line=
=change.to.line)ch+=end.ch-change.to.ch;return Pos(line,ch);};return{anchor:adju
stPos(doc.sel.anchor),head:adjustPos(doc.sel.head)};} | 308 return{anchor:clipPostChange(doc,change,hint.anchor),head:clipPostChange(doc,cha
nge,hint.head)};if(hint=="start")return{anchor:change.from,head:change.from};var
end=changeEnd(change);if(hint=="around")return{anchor:change.from,head:end};if(
hint=="end")return{anchor:end,head:end};var adjustPos=function(pos){if(posLess(p
os,change.from))return pos;if(!posLess(change.to,pos))return end;var line=pos.li
ne+change.text.length-(change.to.line-change.from.line)-1,ch=pos.ch;if(pos.line=
=change.to.line)ch+=end.ch-change.to.ch;return Pos(line,ch);};return{anchor:adju
stPos(doc.sel.anchor),head:adjustPos(doc.sel.head)};} |
304 function filterChange(doc,change,update){var obj={canceled:false,from:change.fro
m,to:change.to,text:change.text,origin:change.origin,cancel:function(){this.canc
eled=true;}};if(update)obj.update=function(from,to,text,origin){if(from)this.fro
m=clipPos(doc,from);if(to)this.to=clipPos(doc,to);if(text)this.text=text;if(orig
in!==undefined)this.origin=origin;};signal(doc,"beforeChange",doc,obj);if(doc.cm
)signal(doc.cm,"beforeChange",doc.cm,obj);if(obj.canceled)return null;return{fro
m:obj.from,to:obj.to,text:obj.text,origin:obj.origin};} | 309 function filterChange(doc,change,update){var obj={canceled:false,from:change.fro
m,to:change.to,text:change.text,origin:change.origin,cancel:function(){this.canc
eled=true;}};if(update)obj.update=function(from,to,text,origin){if(from)this.fro
m=clipPos(doc,from);if(to)this.to=clipPos(doc,to);if(text)this.text=text;if(orig
in!==undefined)this.origin=origin;};signal(doc,"beforeChange",doc,obj);if(doc.cm
)signal(doc.cm,"beforeChange",doc.cm,obj);if(obj.canceled)return null;return{fro
m:obj.from,to:obj.to,text:obj.text,origin:obj.origin};} |
305 function makeChange(doc,change,selUpdate,ignoreReadOnly){if(doc.cm){if(!doc.cm.c
urOp)return operation(doc.cm,makeChange)(doc,change,selUpdate,ignoreReadOnly);if
(doc.cm.state.suppressEdits)return;} | 310 function makeChange(doc,change,selUpdate,ignoreReadOnly){if(doc.cm){if(!doc.cm.c
urOp)return operation(doc.cm,makeChange)(doc,change,selUpdate,ignoreReadOnly);if
(doc.cm.state.suppressEdits)return;} |
306 if(hasHandler(doc,"beforeChange")||doc.cm&&hasHandler(doc.cm,"beforeChange")){ch
ange=filterChange(doc,change,true);if(!change)return;} | 311 if(hasHandler(doc,"beforeChange")||doc.cm&&hasHandler(doc.cm,"beforeChange")){ch
ange=filterChange(doc,change,true);if(!change)return;} |
307 var split=sawReadOnlySpans&&!ignoreReadOnly&&removeReadOnlyRanges(doc,change.fro
m,change.to);if(split){for(var i=split.length-1;i>=1;--i) | 312 var split=sawReadOnlySpans&&!ignoreReadOnly&&removeReadOnlyRanges(doc,change.fro
m,change.to);if(split){for(var i=split.length-1;i>=1;--i) |
(...skipping 14 matching lines...) Expand all Loading... |
322 function makeChangeSingleDocInEditor(cm,change,spans,selAfter){var doc=cm.doc,di
splay=cm.display,from=change.from,to=change.to;var recomputeMaxLength=false,chec
kWidthStart=from.line;if(!cm.options.lineWrapping){checkWidthStart=lineNo(visual
Line(doc,getLine(doc,from.line)));doc.iter(checkWidthStart,to.line+1,function(li
ne){if(line==display.maxLine){recomputeMaxLength=true;return true;}});} | 327 function makeChangeSingleDocInEditor(cm,change,spans,selAfter){var doc=cm.doc,di
splay=cm.display,from=change.from,to=change.to;var recomputeMaxLength=false,chec
kWidthStart=from.line;if(!cm.options.lineWrapping){checkWidthStart=lineNo(visual
Line(doc,getLine(doc,from.line)));doc.iter(checkWidthStart,to.line+1,function(li
ne){if(line==display.maxLine){recomputeMaxLength=true;return true;}});} |
323 if(!posLess(doc.sel.head,change.from)&&!posLess(change.to,doc.sel.head)) | 328 if(!posLess(doc.sel.head,change.from)&&!posLess(change.to,doc.sel.head)) |
324 cm.curOp.cursorActivity=true;updateDoc(doc,change,spans,selAfter,estimateHeight(
cm));if(!cm.options.lineWrapping){doc.iter(checkWidthStart,from.line+change.text
.length,function(line){var len=lineLength(doc,line);if(len>display.maxLineLength
){display.maxLine=line;display.maxLineLength=len;display.maxLineChanged=true;rec
omputeMaxLength=false;}});if(recomputeMaxLength)cm.curOp.updateMaxLine=true;} | 329 cm.curOp.cursorActivity=true;updateDoc(doc,change,spans,selAfter,estimateHeight(
cm));if(!cm.options.lineWrapping){doc.iter(checkWidthStart,from.line+change.text
.length,function(line){var len=lineLength(doc,line);if(len>display.maxLineLength
){display.maxLine=line;display.maxLineLength=len;display.maxLineChanged=true;rec
omputeMaxLength=false;}});if(recomputeMaxLength)cm.curOp.updateMaxLine=true;} |
325 doc.frontier=Math.min(doc.frontier,from.line);startWorker(cm,400);var lendiff=ch
ange.text.length-(to.line-from.line)-1;regChange(cm,from.line,to.line+1,lendiff)
;if(hasHandler(cm,"change")){var changeObj={from:from,to:to,text:change.text,rem
oved:change.removed,origin:change.origin};if(cm.curOp.textChanged){for(var cur=c
m.curOp.textChanged;cur.next;cur=cur.next){} | 330 doc.frontier=Math.min(doc.frontier,from.line);startWorker(cm,400);var lendiff=ch
ange.text.length-(to.line-from.line)-1;regChange(cm,from.line,to.line+1,lendiff)
;if(hasHandler(cm,"change")){var changeObj={from:from,to:to,text:change.text,rem
oved:change.removed,origin:change.origin};if(cm.curOp.textChanged){for(var cur=c
m.curOp.textChanged;cur.next;cur=cur.next){} |
326 cur.next=changeObj;}else cm.curOp.textChanged=changeObj;}} | 331 cur.next=changeObj;}else cm.curOp.textChanged=changeObj;}} |
327 function replaceRange(doc,code,from,to,origin){if(!to)to=from;if(posLess(to,from
)){var tmp=to;to=from;from=tmp;} | 332 function replaceRange(doc,code,from,to,origin){if(!to)to=from;if(posLess(to,from
)){var tmp=to;to=from;from=tmp;} |
328 if(typeof code=="string")code=splitLines(code);makeChange(doc,{from:from,to:to,t
ext:code,origin:origin},null);} | 333 if(typeof code=="string")code=splitLines(code);makeChange(doc,{from:from,to:to,t
ext:code,origin:origin},null);} |
329 function Pos(line,ch){if(!(this instanceof Pos))return new Pos(line,ch);this.lin
e=line;this.ch=ch;} | 334 function Pos(line,ch){if(!(this instanceof Pos))return new Pos(line,ch);this.lin
e=line;this.ch=ch;} |
330 CodeMirror.Pos=Pos;function posEq(a,b){return a.line==b.line&&a.ch==b.ch;} | 335 CodeMirror.Pos=Pos;function posEq(a,b){return a.line==b.line&&a.ch==b.ch;} |
331 function posLess(a,b){return a.line<b.line||(a.line==b.line&&a.ch<b.ch);} | 336 function posLess(a,b){return a.line<b.line||(a.line==b.line&&a.ch<b.ch);} |
| 337 function cmp(a,b){return a.line-b.line||a.ch-b.ch;} |
332 function copyPos(x){return Pos(x.line,x.ch);} | 338 function copyPos(x){return Pos(x.line,x.ch);} |
333 function clipLine(doc,n){return Math.max(doc.first,Math.min(n,doc.first+doc.size
-1));} | 339 function clipLine(doc,n){return Math.max(doc.first,Math.min(n,doc.first+doc.size
-1));} |
334 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.le
ngth);return clipToLen(pos,getLine(doc,pos.line).text.length);} | 340 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.le
ngth);return clipToLen(pos,getLine(doc,pos.line).text.length);} |
335 function clipToLen(pos,linelen){var ch=pos.ch;if(ch==null||ch>linelen)return Pos
(pos.line,linelen);else if(ch<0)return Pos(pos.line,0);else return pos;} | 341 function clipToLen(pos,linelen){var ch=pos.ch;if(ch==null||ch>linelen)return Pos
(pos.line,linelen);else if(ch<0)return Pos(pos.line,0);else return pos;} |
336 function isLine(doc,l){return l>=doc.first&&l<doc.first+doc.size;} | 342 function isLine(doc,l){return l>=doc.first&&l<doc.first+doc.size;} |
337 function extendSelection(doc,pos,other,bias){if(doc.sel.shift||doc.sel.extend){v
ar anchor=doc.sel.anchor;if(other){var posBefore=posLess(pos,anchor);if(posBefor
e!=posLess(other,anchor)){anchor=pos;pos=other;}else if(posBefore!=posLess(pos,o
ther)){pos=other;}} | 343 function extendSelection(doc,pos,other,bias){if(doc.sel.shift||doc.sel.extend){v
ar anchor=doc.sel.anchor;if(other){var posBefore=posLess(pos,anchor);if(posBefor
e!=posLess(other,anchor)){anchor=pos;pos=other;}else if(posBefore!=posLess(pos,o
ther)){pos=other;}} |
338 setSelection(doc,anchor,pos,bias);}else{setSelection(doc,pos,other||pos,bias);} | 344 setSelection(doc,anchor,pos,bias);}else{setSelection(doc,pos,other||pos,bias);} |
339 if(doc.cm)doc.cm.curOp.userSelChange=true;} | 345 if(doc.cm)doc.cm.curOp.userSelChange=true;} |
340 function filterSelectionChange(doc,anchor,head){var obj={anchor:anchor,head:head
};signal(doc,"beforeSelectionChange",doc,obj);if(doc.cm)signal(doc.cm,"beforeSel
ectionChange",doc.cm,obj);obj.anchor=clipPos(doc,obj.anchor);obj.head=clipPos(do
c,obj.head);return obj;} | 346 function filterSelectionChange(doc,anchor,head){var obj={anchor:anchor,head:head
};signal(doc,"beforeSelectionChange",doc,obj);if(doc.cm)signal(doc.cm,"beforeSel
ectionChange",doc.cm,obj);obj.anchor=clipPos(doc,obj.anchor);obj.head=clipPos(do
c,obj.head);return obj;} |
341 function setSelection(doc,anchor,head,bias,checkAtomic){if(!checkAtomic&&hasHand
ler(doc,"beforeSelectionChange")||doc.cm&&hasHandler(doc.cm,"beforeSelectionChan
ge")){var filtered=filterSelectionChange(doc,anchor,head);head=filtered.head;anc
hor=filtered.anchor;} | 347 function setSelection(doc,anchor,head,bias,checkAtomic){if(!checkAtomic&&hasHand
ler(doc,"beforeSelectionChange")||doc.cm&&hasHandler(doc.cm,"beforeSelectionChan
ge")){var filtered=filterSelectionChange(doc,anchor,head);head=filtered.head;anc
hor=filtered.anchor;} |
342 var sel=doc.sel;sel.goalColumn=null;if(bias==null)bias=posLess(head,sel.head)?-1
:1;if(checkAtomic||!posEq(anchor,sel.anchor)) | 348 var sel=doc.sel;sel.goalColumn=null;if(bias==null)bias=posLess(head,sel.head)?-1
:1;if(checkAtomic||!posEq(anchor,sel.anchor)) |
343 anchor=skipAtomic(doc,anchor,bias,checkAtomic!="push");if(checkAtomic||!posEq(he
ad,sel.head)) | 349 anchor=skipAtomic(doc,anchor,bias,checkAtomic!="push");if(checkAtomic||!posEq(he
ad,sel.head)) |
344 head=skipAtomic(doc,head,bias,checkAtomic!="push");if(posEq(sel.anchor,anchor)&&
posEq(sel.head,head))return;sel.anchor=anchor;sel.head=head;var inv=posLess(head
,anchor);sel.from=inv?head:anchor;sel.to=inv?anchor:head;if(doc.cm) | 350 head=skipAtomic(doc,head,bias,checkAtomic!="push");if(posEq(sel.anchor,anchor)&&
posEq(sel.head,head))return;sel.anchor=anchor;sel.head=head;var inv=posLess(head
,anchor);sel.from=inv?head:anchor;sel.to=inv?anchor:head;if(doc.cm) |
345 doc.cm.curOp.updateInput=doc.cm.curOp.selectionChanged=doc.cm.curOp.cursorActivi
ty=true;signalLater(doc,"cursorActivity",doc);} | 351 doc.cm.curOp.updateInput=doc.cm.curOp.selectionChanged=doc.cm.curOp.cursorActivi
ty=true;signalLater(doc,"cursorActivity",doc);} |
346 function reCheckSelection(cm){setSelection(cm.doc,cm.doc.sel.from,cm.doc.sel.to,
null,"push");} | 352 function reCheckSelection(cm){setSelection(cm.doc,cm.doc.sel.from,cm.doc.sel.to,
null,"push");} |
347 function skipAtomic(doc,pos,bias,mayClear){var flipped=false,curPos=pos;var dir=
bias||1;doc.cantEdit=false;search:for(;;){var line=getLine(doc,curPos.line);if(l
ine.markedSpans){for(var i=0;i<line.markedSpans.length;++i){var sp=line.markedSp
ans[i],m=sp.marker;if((sp.from==null||(m.inclusiveLeft?sp.from<=curPos.ch:sp.fro
m<curPos.ch))&&(sp.to==null||(m.inclusiveRight?sp.to>=curPos.ch:sp.to>curPos.ch)
)){if(mayClear){signal(m,"beforeCursorEnter");if(m.explicitlyCleared){if(!line.m
arkedSpans)break;else{--i;continue;}}} | 353 function skipAtomic(doc,pos,bias,mayClear){var flipped=false,curPos=pos;var dir=
bias||1;doc.cantEdit=false;search:for(;;){var line=getLine(doc,curPos.line);if(l
ine.markedSpans){for(var i=0;i<line.markedSpans.length;++i){var sp=line.markedSp
ans[i],m=sp.marker;if((sp.from==null||(m.inclusiveLeft?sp.from<=curPos.ch:sp.fro
m<curPos.ch))&&(sp.to==null||(m.inclusiveRight?sp.to>=curPos.ch:sp.to>curPos.ch)
)){if(mayClear){signal(m,"beforeCursorEnter");if(m.explicitlyCleared){if(!line.m
arkedSpans)break;else{--i;continue;}}} |
348 if(!m.atomic)continue;var newPos=m.find()[dir<0?"from":"to"];if(posEq(newPos,cur
Pos)){newPos.ch+=dir;if(newPos.ch<0){if(newPos.line>doc.first)newPos=clipPos(doc
,Pos(newPos.line-1));else newPos=null;}else if(newPos.ch>line.text.length){if(ne
wPos.line<doc.first+doc.size-1)newPos=Pos(newPos.line+1,0);else newPos=null;} | 354 if(!m.atomic)continue;var newPos=m.find()[dir<0?"from":"to"];if(posEq(newPos,cur
Pos)){newPos.ch+=dir;if(newPos.ch<0){if(newPos.line>doc.first)newPos=clipPos(doc
,Pos(newPos.line-1));else newPos=null;}else if(newPos.ch>line.text.length){if(ne
wPos.line<doc.first+doc.size-1)newPos=Pos(newPos.line+1,0);else newPos=null;} |
349 if(!newPos){if(flipped){if(!mayClear)return skipAtomic(doc,pos,bias,true);doc.ca
ntEdit=true;return Pos(doc.first,0);} | 355 if(!newPos){if(flipped){if(!mayClear)return skipAtomic(doc,pos,bias,true);doc.ca
ntEdit=true;return Pos(doc.first,0);} |
350 flipped=true;newPos=pos;dir=-dir;}} | 356 flipped=true;newPos=pos;dir=-dir;}} |
351 curPos=newPos;continue search;}}} | 357 curPos=newPos;continue search;}}} |
352 return curPos;}} | 358 return curPos;}} |
353 function scrollCursorIntoView(cm){var coords=scrollPosIntoView(cm,cm.doc.sel.hea
d,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)doScro
ll=true;else if(coords.bottom+box.top>(window.innerHeight||document.documentElem
ent.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";} | 359 function scrollCursorIntoView(cm){var coords=scrollPosIntoView(cm,cm.doc.sel.hea
d,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)doScro
ll=true;else if(coords.bottom+box.top>(window.innerHeight||document.documentElem
ent.clientHeight))doScroll=false;if(doScroll!=null&&!phantom){var scrollNode=elt
("div","\u200b",null,"position: absolute; top: "+ |
354 display.cursor.scrollIntoView(doScroll);if(hidden)display.cursor.style.display="
none";}} | 360 (coords.top-display.viewOffset)+"px; height: "+ |
| 361 (coords.bottom-coords.top+scrollerCutOff)+"px; left: "+ |
| 362 coords.left+"px; width: 2px;");cm.display.lineSpace.appendChild(scrollNode);scro
llNode.scrollIntoView(doScroll);cm.display.lineSpace.removeChild(scrollNode);}} |
355 function scrollPosIntoView(cm,pos,end,margin){if(margin==null)margin=0;for(;;){v
ar changed=false,coords=cursorCoords(cm,pos);var endCoords=!end||end==pos?coords
:cursorCoords(cm,end);var scrollPos=calculateScrollPos(cm,Math.min(coords.left,e
ndCoords.left),Math.min(coords.top,endCoords.top)-margin,Math.max(coords.left,en
dCoords.left),Math.max(coords.bottom,endCoords.bottom)+margin);var startTop=cm.d
oc.scrollTop,startLeft=cm.doc.scrollLeft;if(scrollPos.scrollTop!=null){setScroll
Top(cm,scrollPos.scrollTop);if(Math.abs(cm.doc.scrollTop-startTop)>1)changed=tru
e;} | 363 function scrollPosIntoView(cm,pos,end,margin){if(margin==null)margin=0;for(;;){v
ar changed=false,coords=cursorCoords(cm,pos);var endCoords=!end||end==pos?coords
:cursorCoords(cm,end);var scrollPos=calculateScrollPos(cm,Math.min(coords.left,e
ndCoords.left),Math.min(coords.top,endCoords.top)-margin,Math.max(coords.left,en
dCoords.left),Math.max(coords.bottom,endCoords.bottom)+margin);var startTop=cm.d
oc.scrollTop,startLeft=cm.doc.scrollLeft;if(scrollPos.scrollTop!=null){setScroll
Top(cm,scrollPos.scrollTop);if(Math.abs(cm.doc.scrollTop-startTop)>1)changed=tru
e;} |
356 if(scrollPos.scrollLeft!=null){setScrollLeft(cm,scrollPos.scrollLeft);if(Math.ab
s(cm.doc.scrollLeft-startLeft)>1)changed=true;} | 364 if(scrollPos.scrollLeft!=null){setScrollLeft(cm,scrollPos.scrollLeft);if(Math.ab
s(cm.doc.scrollLeft-startLeft)>1)changed=true;} |
357 if(!changed)return coords;}} | 365 if(!changed)return coords;}} |
358 function scrollIntoView(cm,x1,y1,x2,y2){var scrollPos=calculateScrollPos(cm,x1,y
1,x2,y2);if(scrollPos.scrollTop!=null)setScrollTop(cm,scrollPos.scrollTop);if(sc
rollPos.scrollLeft!=null)setScrollLeft(cm,scrollPos.scrollLeft);} | 366 function scrollIntoView(cm,x1,y1,x2,y2){var scrollPos=calculateScrollPos(cm,x1,y
1,x2,y2);if(scrollPos.scrollTop!=null)setScrollTop(cm,scrollPos.scrollTop);if(sc
rollPos.scrollLeft!=null)setScrollLeft(cm,scrollPos.scrollLeft);} |
359 function calculateScrollPos(cm,x1,y1,x2,y2){var display=cm.display,snapMargin=te
xtHeight(cm.display);if(y1<0)y1=0;var screen=display.scroller.clientHeight-scrol
lerCutOff,screentop=display.scroller.scrollTop,result={};var docBottom=cm.doc.he
ight+paddingVert(display);var atTop=y1<snapMargin,atBottom=y2>docBottom-snapMarg
in;if(y1<screentop){result.scrollTop=atTop?0:y1;}else if(y2>screentop+screen){va
r newTop=Math.min(y1,(atBottom?docBottom:y2)-screen);if(newTop!=screentop)result
.scrollTop=newTop;} | 367 function calculateScrollPos(cm,x1,y1,x2,y2){var display=cm.display,snapMargin=te
xtHeight(cm.display);if(y1<0)y1=0;var screen=display.scroller.clientHeight-scrol
lerCutOff,screentop=display.scroller.scrollTop,result={};var docBottom=cm.doc.he
ight+paddingVert(display);var atTop=y1<snapMargin,atBottom=y2>docBottom-snapMarg
in;if(y1<screentop){result.scrollTop=atTop?0:y1;}else if(y2>screentop+screen){va
r newTop=Math.min(y1,(atBottom?docBottom:y2)-screen);if(newTop!=screentop)result
.scrollTop=newTop;} |
360 var screenw=display.scroller.clientWidth-scrollerCutOff,screenleft=display.scrol
ler.scrollLeft;x1+=display.gutters.offsetWidth;x2+=display.gutters.offsetWidth;v
ar gutterw=display.gutters.offsetWidth;var atLeft=x1<gutterw+10;if(x1<screenleft
+gutterw||atLeft){if(atLeft)x1=0;result.scrollLeft=Math.max(0,x1-10-gutterw);}el
se if(x2>screenw+screenleft-3){result.scrollLeft=x2+10-screenw;} | 368 var screenw=display.scroller.clientWidth-scrollerCutOff,screenleft=display.scrol
ler.scrollLeft;x1+=display.gutters.offsetWidth;x2+=display.gutters.offsetWidth;v
ar gutterw=display.gutters.offsetWidth;var atLeft=x1<gutterw+10;if(x1<screenleft
+gutterw||atLeft){if(atLeft)x1=0;result.scrollLeft=Math.max(0,x1-10-gutterw);}el
se if(x2>screenw+screenleft-3){result.scrollLeft=x2+10-screenw;} |
361 return result;} | 369 return result;} |
362 function updateScrollPos(cm,left,top){cm.curOp.updateScrollPos={scrollLeft:left=
=null?cm.doc.scrollLeft:left,scrollTop:top==null?cm.doc.scrollTop:top};} | 370 function updateScrollPos(cm,left,top){cm.curOp.updateScrollPos={scrollLeft:left=
=null?cm.doc.scrollLeft:left,scrollTop:top==null?cm.doc.scrollTop:top};} |
363 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(scro
ll.scrollWidth-scroll.clientWidth,pos.scrollLeft+left));} | 371 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(scro
ll.scrollWidth-scroll.clientWidth,pos.scrollLeft+left));} |
364 function indentLine(cm,n,how,aggressive){var doc=cm.doc;if(how==null)how="add";i
f(how=="smart"){if(!cm.doc.mode.indent)how="prev";else var state=getStateBefore(
cm,n);} | 372 function indentLine(cm,n,how,aggressive){var doc=cm.doc;if(how==null)how="add";i
f(how=="smart"){if(!cm.doc.mode.indent)how="prev";else var state=getStateBefore(
cm,n);} |
365 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(curSpaceStri
ng.length),line.text);if(indentation==Pass){if(!aggressive)return;how="prev";}} | 373 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=="smar
t"){indentation=cm.doc.mode.indent(state,line.text.slice(curSpaceString.length),
line.text);if(indentation==Pass){if(!aggressive)return;how="prev";}} |
366 if(how=="prev"){if(n>doc.first)indentation=countColumn(getLine(doc,n-1).text,nul
l,tabSize);else indentation=0;}else if(how=="add"){indentation=curSpace+cm.optio
ns.indentUnit;}else if(how=="subtract"){indentation=curSpace-cm.options.indentUn
it;}else if(typeof how=="number"){indentation=curSpace+how;} | 374 if(how=="prev"){if(n>doc.first)indentation=countColumn(getLine(doc,n-1).text,nul
l,tabSize);else indentation=0;}else if(how=="add"){indentation=curSpace+cm.optio
ns.indentUnit;}else if(how=="subtract"){indentation=curSpace-cm.options.indentUn
it;}else if(typeof how=="number"){indentation=curSpace+how;} |
367 indentation=Math.max(0,indentation);var indentString="",pos=0;if(cm.options.inde
ntWithTabs) | 375 indentation=Math.max(0,indentation);var indentString="",pos=0;if(cm.options.inde
ntWithTabs) |
368 for(var i=Math.floor(indentation/tabSize);i;--i){pos+=tabSize;indentString+="\t"
;} | 376 for(var i=Math.floor(indentation/tabSize);i;--i){pos+=tabSize;indentString+="\t"
;} |
369 if(pos<indentation)indentString+=spaceStr(indentation-pos);if(indentString!=curS
paceString) | 377 if(pos<indentation)indentString+=spaceStr(indentation-pos);if(indentString!=curS
paceString) |
370 replaceRange(cm.doc,indentString,Pos(n,0),Pos(n,curSpaceString.length),"+input")
;else if(doc.sel.head.line==n&&doc.sel.head.ch<curSpaceString.length) | 378 replaceRange(cm.doc,indentString,Pos(n,0),Pos(n,curSpaceString.length),"+input")
;else if(doc.sel.head.line==n&&doc.sel.head.ch<curSpaceString.length) |
371 setSelection(doc,Pos(n,curSpaceString.length),Pos(n,curSpaceString.length),1);li
ne.stateAfter=null;} | 379 setSelection(doc,Pos(n,curSpaceString.length),Pos(n,curSpaceString.length),1);li
ne.stateAfter=null;} |
372 function changeLine(cm,handle,op){var no=handle,line=handle,doc=cm.doc;if(typeof
handle=="number")line=getLine(doc,clipLine(doc,handle));else no=lineNo(handle);
if(no==null)return null;if(op(line,no))regChange(cm,no,no+1);else return null;re
turn line;} | 380 function changeLine(cm,handle,op){var no=handle,line=handle,doc=cm.doc;if(typeof
handle=="number")line=getLine(doc,clipLine(doc,handle));else no=lineNo(handle);
if(no==null)return null;if(op(line,no))regChange(cm,no,no+1);else return null;re
turn line;} |
373 function findPosH(doc,pos,dir,unit,visually){var line=pos.line,ch=pos.ch,origDir
=dir;var lineObj=getLine(doc,line);var possible=true;function findNextLine(){var
l=line+dir;if(l<doc.first||l>=doc.first+doc.size)return(possible=false);line=l;
return lineObj=getLine(doc,l);} | 381 function findPosH(doc,pos,dir,unit,visually){var line=pos.line,ch=pos.ch,origDir
=dir;var lineObj=getLine(doc,line);var possible=true;function findNextLine(){var
l=line+dir;if(l<doc.first||l>=doc.first+doc.size)return(possible=false);line=l;
return lineObj=getLine(doc,l);} |
374 function moveOnce(boundToLine){var next=(visually?moveVisually:moveLogically)(li
neObj,ch,dir,true);if(next==null){if(!boundToLine&&findNextLine()){if(visually)c
h=(dir<0?lineRight:lineLeft)(lineObj);else ch=dir<0?lineObj.text.length:0;}else
return(possible=false);}else ch=next;return true;} | 382 function moveOnce(boundToLine){var next=(visually?moveVisually:moveLogically)(li
neObj,ch,dir,true);if(next==null){if(!boundToLine&&findNextLine()){if(visually)c
h=(dir<0?lineRight:lineLeft)(lineObj);else ch=dir<0?lineObj.text.length:0;}else
return(possible=false);}else ch=next;return true;} |
375 if(unit=="char")moveOnce();else if(unit=="column")moveOnce(true);else if(unit=="
word"||unit=="group"){var sawType=null,group=unit=="group";for(var first=true;;f
irst=false){if(dir<0&&!moveOnce(!first))break;var cur=lineObj.text.charAt(ch)||"
\n";var type=isWordChar(cur)?"w":!group?null:/\s/.test(cur)?null:"p";if(sawType&
&sawType!=type){if(dir<0){dir=1;moveOnce();} | 383 if(unit=="char")moveOnce();else if(unit=="column")moveOnce(true);else if(unit=="
word"||unit=="group"){var sawType=null,group=unit=="group";for(var first=true;;f
irst=false){if(dir<0&&!moveOnce(!first))break;var cur=lineObj.text.charAt(ch)||"
\n";var type=isWordChar(cur)?"w":!group?null:/\s/.test(cur)?null:"p";if(sawType&
&sawType!=type){if(dir<0){dir=1;moveOnce();} |
376 break;} | 384 break;} |
377 if(type)sawType=type;if(dir>0&&!moveOnce(!first))break;}} | 385 if(type)sawType=type;if(dir>0&&!moveOnce(!first))break;}} |
378 var result=skipAtomic(doc,Pos(line,ch),origDir,true);if(!possible)result.hitSide
=true;return result;} | 386 var result=skipAtomic(doc,Pos(line,ch),origDir,true);if(!possible)result.hitSide
=true;return result;} |
379 function findPosV(cm,pos,dir,unit){var doc=cm.doc,x=pos.left,y;if(unit=="page"){
var pageSize=Math.min(cm.display.wrapper.clientHeight,window.innerHeight||docume
nt.documentElement.clientHeight);y=pos.top+dir*(pageSize-(dir<0?1.5:.5)*textHeig
ht(cm.display));}else if(unit=="line"){y=dir>0?pos.bottom+3:pos.top-3;} | 387 function findPosV(cm,pos,dir,unit){var doc=cm.doc,x=pos.left,y;if(unit=="page"){
var pageSize=Math.min(cm.display.wrapper.clientHeight,window.innerHeight||docume
nt.documentElement.clientHeight);y=pos.top+dir*(pageSize-(dir<0?1.5:.5)*textHeig
ht(cm.display));}else if(unit=="line"){y=dir>0?pos.bottom+3:pos.top-3;} |
380 for(;;){var target=coordsChar(cm,x,y);if(!target.outside)break;if(dir<0?y<=0:y>=
doc.height){target.hitSide=true;break;} | 388 for(;;){var target=coordsChar(cm,x,y);if(!target.outside)break;if(dir<0?y<=0:y>=
doc.height){target.hitSide=true;break;} |
381 y+=dir*5;} | 389 y+=dir*5;} |
382 return target;} | 390 return target;} |
383 function findWordAt(line,pos){var start=pos.ch,end=pos.ch;if(line){if((pos.xRel<
0||end==line.length)&&start)--start;else++end;var startChar=line.charAt(start);v
ar check=isWordChar(startChar)?isWordChar:/\s/.test(startChar)?function(ch){retu
rn/\s/.test(ch);}:function(ch){return!/\s/.test(ch)&&!isWordChar(ch);};while(sta
rt>0&&check(line.charAt(start-1)))--start;while(end<line.length&&check(line.char
At(end)))++end;} | 391 function findWordAt(line,pos){var start=pos.ch,end=pos.ch;if(line){if((pos.xRel<
0||end==line.length)&&start)--start;else++end;var startChar=line.charAt(start);v
ar check=isWordChar(startChar)?isWordChar:/\s/.test(startChar)?function(ch){retu
rn/\s/.test(ch);}:function(ch){return!/\s/.test(ch)&&!isWordChar(ch);};while(sta
rt>0&&check(line.charAt(start-1)))--start;while(end<line.length&&check(line.char
At(end)))++end;} |
384 return{from:Pos(pos.line,start),to:Pos(pos.line,end)};} | 392 return{from:Pos(pos.line,start),to:Pos(pos.line,end)};} |
385 function selectLine(cm,line){extendSelection(cm.doc,Pos(line,0),clipPos(cm.doc,P
os(line+1,0)));} | 393 function selectLine(cm,line){extendSelection(cm.doc,Pos(line,0),clipPos(cm.doc,P
os(line+1,0)));} |
386 CodeMirror.prototype={constructor:CodeMirror,focus:function(){window.focus();foc
usInput(this);fastPoll(this);},setOption:function(option,value){var options=this
.options,old=options[option];if(options[option]==value&&option!="mode")return;op
tions[option]=value;if(optionHandlers.hasOwnProperty(option)) | 394 CodeMirror.prototype={constructor:CodeMirror,focus:function(){window.focus();foc
usInput(this);fastPoll(this);},setOption:function(option,value){var options=this
.options,old=options[option];if(options[option]==value&&option!="mode")return;op
tions[option]=value;if(optionHandlers.hasOwnProperty(option)) |
387 operation(this,optionHandlers[option])(this,value,old);},getOption:function(opti
on){return this.options[option];},getDoc:function(){return this.doc;},addKeyMap:
function(map,bottom){this.state.keyMaps[bottom?"push":"unshift"](map);},removeKe
yMap:function(map){var maps=this.state.keyMaps;for(var i=0;i<maps.length;++i) | 395 operation(this,optionHandlers[option])(this,value,old);},getOption:function(opti
on){return this.options[option];},getDoc:function(){return this.doc;},addKeyMap:
function(map,bottom){this.state.keyMaps[bottom?"push":"unshift"](map);},removeKe
yMap:function(map){var maps=this.state.keyMaps;for(var i=0;i<maps.length;++i) |
388 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.t
oken?spec:CodeMirror.getMode(this.options,spec);if(mode.startState)throw new Err
or("Overlays may not be stateful.");this.state.overlays.push({mode:mode,modeSpec
:spec,opaque:options&&options.opaque});this.state.modeGen++;regChange(this);}),r
emoveOverlay: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++;regCh
ange(this);return;}}}),indentLine:operation(null,function(n,dir,aggressive){if(t
ypeof dir!="string"&&typeof dir!="number"){if(dir==null)dir=this.options.smartIn
dent?"smart":"prev";else dir=dir?"add":"subtract";} | 396 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.t
oken?spec:CodeMirror.getMode(this.options,spec);if(mode.startState)throw new Err
or("Overlays may not be stateful.");this.state.overlays.push({mode:mode,modeSpec
:spec,opaque:options&&options.opaque});this.state.modeGen++;regChange(this);}),r
emoveOverlay: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++;regCh
ange(this);return;}}}),indentLine:operation(null,function(n,dir,aggressive){if(t
ypeof dir!="string"&&typeof dir!="number"){if(dir==null)dir=this.options.smartIn
dent?"smart":"prev";else dir=dir?"add":"subtract";} |
389 if(isLine(this.doc,n))indentLine(this,n,dir,aggressive);}),indentSelection:opera
tion(null,function(how){var sel=this.doc.sel;if(posEq(sel.from,sel.to))return in
dentLine(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){v
ar doc=this.doc;pos=clipPos(doc,pos);var state=getStateBefore(this,pos.line,prec
ise),mode=this.doc.mode;var line=getLine(doc,pos.line);var stream=new StringStre
am(line.text,this.options.tabSize);while(stream.pos<pos.ch&&!stream.eol()){strea
m.start=stream.pos;var style=mode.token(stream,state);} | 397 if(isLine(this.doc,n))indentLine(this,n,dir,aggressive);}),indentSelection:opera
tion(null,function(how){var sel=this.doc.sel;if(posEq(sel.from,sel.to))return in
dentLine(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,preci
se){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 Strin
gStream(line.text,this.options.tabSize);while(stream.pos<pos.ch&&!stream.eol()){
stream.start=stream.pos;var style=mode.token(stream,state);} |
390 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 befo
re=0,after=(styles.length-1)/2,ch=pos.ch;if(ch==0)return styles[2];for(;;){var m
id=(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(m
ode,this.getTokenAt(pos).state).mode;},getHelper:function(pos,type){if(!helpers.
hasOwnProperty(type))return;var help=helpers[type],mode=this.getModeAt(pos);retu
rn mode[type]&&help[mode[type]]||mode.helperType&&help[mode.helperType]||help[mo
de.name];},getStateAfter:function(line,precise){var doc=this.doc;line=clipLine(d
oc,line==null?doc.first+doc.size-1:line);return getStateBefore(this,line+1,preci
se);},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:f
unction(pos,mode){return charCoords(this,clipPos(this.doc,pos),mode||"page");},c
oordsChar:function(coords,mode){coords=fromCoordSystem(this,coords,mode||"page")
;return coordsChar(this,coords.left,coords.top);},lineAtHeight:function(height,m
ode){height=fromCoordSystem(this,{top:height,left:0},mode||"page").top;return li
neAtHeight(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;} | 398 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 befo
re=0,after=(styles.length-1)/2,ch=pos.ch;if(ch==0)return styles[2];for(;;){var m
id=(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(m
ode,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[ty
pe]]);}else if(mode[type]){for(var i=0;i<mode[type].length;i++){var val=help[mod
e[type][i]];if(val)found.push(val);}}else if(mode.helperType&&help[mode.helperTy
pe]){found.push(help[mode.helperType]);}else if(help[mode.name]){found.push(help
[mode.name]);} |
| 399 for(var i=0;i<help._global.length;i++){var cur=help._global[i];if(cur.pred(mode,
this)&&indexOf(found,cur.val)==-1) |
| 400 found.push(cur.val);} |
| 401 return found;},getStateAfter:function(line,precise){var doc=this.doc;line=clipLi
ne(doc,line==null?doc.first+doc.size-1:line);return getStateBefore(this,line+1,p
recise);},cursorCoords:function(start,mode){var pos,sel=this.doc.sel;if(start==n
ull)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");},charCoor
ds:function(pos,mode){return charCoords(this,clipPos(this.doc,pos),mode||"page")
;},coordsChar:function(coords,mode){coords=fromCoordSystem(this,coords,mode||"pa
ge");return coordsChar(this,coords.left,coords.top);},lineAtHeight:function(heig
ht,mode){height=fromCoordSystem(this,{top:height,left:0},mode||"page").top;retur
n 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.fi
rst)line=this.doc.first;else if(line>last){line=last;end=true;} |
391 var lineObj=getLine(this.doc,line);return intoCoordSystem(this,getLine(this.doc,
line),{top:0,left:0},mode||"page").top+ | 402 var lineObj=getLine(this.doc,line);return intoCoordSystem(this,getLine(this.doc,
line),{top:0,left:0},mode||"page").top+ |
392 (end?lineObj.height:0);},defaultTextHeight:function(){return textHeight(this.dis
play);},defaultCharWidth:function(){return charWidth(this.display);},setGutterMa
rker:operation(null,function(line,gutterID,value){return changeLine(this,line,fu
nction(line){var markers=line.gutterMarkers||(line.gutterMarkers={});markers[gut
terID]=value;if(!value&&isEmpty(markers))line.gutterMarkers=null;return true;});
}),clearGutter:operation(null,function(gutterID){var cm=this,doc=cm.doc,i=doc.fi
rst;doc.iter(function(line){if(line.gutterMarkers&&line.gutterMarkers[gutterID])
{line.gutterMarkers[gutterID]=null;regChange(cm,i,i+1);if(isEmpty(line.gutterMar
kers))line.gutterMarkers=null;} | 403 (end?lineObj.height:0);},defaultTextHeight:function(){return textHeight(this.dis
play);},defaultCharWidth:function(){return charWidth(this.display);},setGutterMa
rker:operation(null,function(line,gutterID,value){return changeLine(this,line,fu
nction(line){var markers=line.gutterMarkers||(line.gutterMarkers={});markers[gut
terID]=value;if(!value&&isEmpty(markers))line.gutterMarkers=null;return true;});
}),clearGutter:operation(null,function(gutterID){var cm=this,doc=cm.doc,i=doc.fi
rst;doc.iter(function(line){if(line.gutterMarkers&&line.gutterMarkers[gutterID])
{line.gutterMarkers[gutterID]=null;regChange(cm,i,i+1);if(isEmpty(line.gutterMar
kers))line.gutterMarkers=null;} |
393 ++i;});}),addLineClass:operation(null,function(handle,where,cls){return changeLi
ne(this,handle,function(line){var prop=where=="text"?"textClass":where=="backgro
und"?"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){retu
rn changeLine(this,handle,function(line){var prop=where=="text"?"textClass":wher
e=="background"?"bgClass":"wrapClass";var cur=line[prop];if(!cur)return false;el
se 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;l
ine[prop]=cur.slice(0,found.index)+(!found.index||end==cur.length?"":" ")+cur.sl
ice(end)||null;} | 404 ++i;});}),addLineClass:operation(null,function(handle,where,cls){return changeLi
ne(this,handle,function(line){var prop=where=="text"?"textClass":where=="backgro
und"?"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){retu
rn changeLine(this,handle,function(line){var prop=where=="text"?"textClass":wher
e=="background"?"bgClass":"wrapClass";var cur=line[prop];if(!cur)return false;el
se 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;l
ine[prop]=cur.slice(0,found.index)+(!found.index||end==cur.length?"":" ")+cur.sl
ice(end)||null;} |
394 return true;});}),addLineWidget:operation(null,function(handle,node,options){ret
urn addLineWidget(this,handle,node,options);}),removeLineWidget:function(widget)
{widget.clear();},lineInfo:function(line){if(typeof line=="number"){if(!isLine(t
his.doc,line))return null;var n=line;line=getLine(this.doc,line);if(!line)return
null;}else{var n=lineNo(line);if(n==null)return null;} | 405 return true;});}),addLineWidget:operation(null,function(handle,node,options){ret
urn addLineWidget(this,handle,node,options);}),removeLineWidget:function(widget)
{widget.clear();},lineInfo:function(line){if(typeof line=="number"){if(!isLine(t
his.doc,line))return null;var n=line;line=getLine(this.doc,line);if(!line)return
null;}else{var n=lineNo(line);if(n==null)return null;} |
395 return{line:n,handle:line,text:line.text,gutterMarkers:line.gutterMarkers,textCl
ass:line.textClass,bgClass:line.bgClass,wrapClass:line.wrapClass,widgets:line.wi
dgets};},getViewport:function(){return{from:this.display.showingFrom,to:this.dis
play.showingTo};},addWidget:function(pos,node,scroll,vert,horiz){var display=thi
s.display;pos=cursorCoords(this,clipPos(this.doc,pos));var top=pos.bottom,left=p
os.left;node.style.position="absolute";display.sizer.appendChild(node);if(vert==
"over"){top=pos.top;}else if(vert=="above"||vert=="near"){var vspace=Math.max(di
splay.wrapper.clientHeight,this.doc.height),hspace=Math.max(display.sizer.client
Width,display.lineSpace.clientWidth);if((vert=='above'||pos.bottom+node.offsetHe
ight>vspace)&&pos.top>node.offsetHeight) | 406 return{line:n,handle:line,text:line.text,gutterMarkers:line.gutterMarkers,textCl
ass:line.textClass,bgClass:line.bgClass,wrapClass:line.wrapClass,widgets:line.wi
dgets};},getViewport:function(){return{from:this.display.showingFrom,to:this.dis
play.showingTo};},addWidget:function(pos,node,scroll,vert,horiz){var display=thi
s.display;pos=cursorCoords(this,clipPos(this.doc,pos));var top=pos.bottom,left=p
os.left;node.style.position="absolute";display.sizer.appendChild(node);if(vert==
"over"){top=pos.top;}else if(vert=="above"||vert=="near"){var vspace=Math.max(di
splay.wrapper.clientHeight,this.doc.height),hspace=Math.max(display.sizer.client
Width,display.lineSpace.clientWidth);if((vert=='above'||pos.bottom+node.offsetHe
ight>vspace)&&pos.top>node.offsetHeight) |
396 top=pos.top-node.offsetHeight;else if(pos.bottom+node.offsetHeight<=vspace) | 407 top=pos.top-node.offsetHeight;else if(pos.bottom+node.offsetHeight<=vspace) |
397 top=pos.bottom;if(left+node.offsetWidth>hspace) | 408 top=pos.bottom;if(left+node.offsetWidth>hspace) |
398 left=hspace-node.offsetWidth;} | 409 left=hspace-node.offsetWidth;} |
399 node.style.top=top+"px";node.style.left=node.style.right="";if(horiz=="right"){l
eft=display.sizer.clientWidth-node.offsetWidth;node.style.right="0px";}else{if(h
oriz=="left")left=0;else if(horiz=="middle")left=(display.sizer.clientWidth-node
.offsetWidth)/2;node.style.left=left+"px";} | 410 node.style.top=top+"px";node.style.left=node.style.right="";if(horiz=="right"){l
eft=display.sizer.clientWidth-node.offsetWidth;node.style.right="0px";}else{if(h
oriz=="left")left=0;else if(horiz=="middle")left=(display.sizer.clientWidth-node
.offsetWidth)/2;node.style.left=left+"px";} |
400 if(scroll) | 411 if(scroll) |
401 scrollIntoView(this,left,top,left+node.offsetWidth,top+node.offsetHeight);},trig
gerOnKeyDown: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;} | 412 scrollIntoView(this,left,top,left+node.offsetWidth,top+node.offsetHeight);},trig
gerOnKeyDown:operation(null,onKeyDown),triggerOnKeyPress:operation(null,onKeyPre
ss),triggerOnKeyUp:operation(null,onKeyUp),execCommand:function(cmd){if(commands
.hasOwnProperty(cmd)) |
| 413 return commands[cmd](this);},findPosH:function(from,amount,unit,visually){var di
r=1;if(amount<0){dir=-1;amount=-amount;} |
402 for(var i=0,cur=clipPos(this.doc,from);i<amount;++i){cur=findPosH(this.doc,cur,d
ir,unit,visually);if(cur.hitSide)break;} | 414 for(var i=0,cur=clipPos(this.doc,from);i<amount;++i){cur=findPosH(this.doc,cur,d
ir,unit,visually);if(cur.hitSide)break;} |
403 return cur;},moveH:operation(null,function(dir,unit){var sel=this.doc.sel,pos;if
(sel.shift||sel.extend||posEq(sel.from,sel.to)) | 415 return cur;},moveH:operation(null,function(dir,unit){var sel=this.doc.sel,pos;if
(sel.shift||sel.extend||posEq(sel.from,sel.to)) |
404 pos=findPosH(this.doc,sel.head,dir,unit,this.options.rtlMoveVisually);else | 416 pos=findPosH(this.doc,sel.head,dir,unit,this.options.rtlMoveVisually);else |
405 pos=dir<0?sel.from:sel.to;extendSelection(this.doc,pos,pos,dir);}),deleteH:opera
tion(null,function(dir,unit){var sel=this.doc.sel;if(!posEq(sel.from,sel.to))rep
laceRange(this.doc,"",sel.from,sel.to,"+delete");else replaceRange(this.doc,"",s
el.from,findPosH(this.doc,sel.head,dir,unit,false),"+delete");this.curOp.userSel
Change=true;}),findPosV:function(from,amount,unit,goalColumn){var dir=1,x=goalCo
lumn;if(amount<0){dir=-1;amount=-amount;} | 417 pos=dir<0?sel.from:sel.to;extendSelection(this.doc,pos,pos,dir);}),deleteH:opera
tion(null,function(dir,unit){var sel=this.doc.sel;if(!posEq(sel.from,sel.to))rep
laceRange(this.doc,"",sel.from,sel.to,"+delete");else replaceRange(this.doc,"",s
el.from,findPosH(this.doc,sel.head,dir,unit,false),"+delete");this.curOp.userSel
Change=true;}),findPosV:function(from,amount,unit,goalColumn){var dir=1,x=goalCo
lumn;if(amount<0){dir=-1;amount=-amount;} |
406 for(var i=0,cur=clipPos(this.doc,from);i<amount;++i){var coords=cursorCoords(thi
s,cur,"div");if(x==null)x=coords.left;else coords.left=x;cur=findPosV(this,coord
s,dir,unit);if(cur.hitSide)break;} | 418 for(var i=0,cur=clipPos(this.doc,from);i<amount;++i){var coords=cursorCoords(thi
s,cur,"div");if(x==null)x=coords.left;else coords.left=x;cur=findPosV(this,coord
s,dir,unit);if(cur.hitSide)break;} |
407 return cur;},moveV:operation(null,function(dir,unit){var sel=this.doc.sel;var po
s=cursorCoords(this,sel.head,"div");if(sel.goalColumn!=null)pos.left=sel.goalCol
umn;var target=findPosV(this,pos,dir,unit);if(unit=="page")addToScrollPos(this,0
,charCoords(this,target,"div").top-pos.top);extendSelection(this.doc,target,targ
et,dir);sel.goalColumn=pos.left;}),toggleOverwrite:function(value){if(value!=nul
l&&value==this.state.overwrite)return;if(this.state.overwrite=!this.state.overwr
ite) | 419 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(thi
s,sel.head,"div");if(sel.goalColumn!=null)pos.left=sel.goalColumn;target=findPos
V(this,pos,dir,unit);if(unit=="page")addToScrollPos(this,0,charCoords(this,targe
t,"div").top-pos.top);goal=pos.left;}else{target=dir<0?sel.from:sel.to;} |
| 420 extendSelection(this.doc,target,target,dir);if(goal!=null)sel.goalColumn=goal;})
,toggleOverwrite:function(value){if(value!=null&&value==this.state.overwrite)ret
urn;if(this.state.overwrite=!this.state.overwrite) |
408 this.display.cursor.className+=" CodeMirror-overwrite";else | 421 this.display.cursor.className+=" CodeMirror-overwrite";else |
409 this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror
-overwrite","");},hasFocus:function(){return this.state.focused;},scrollTo:opera
tion(null,function(x,y){updateScrollPos(this,x,y);}),getScrollInfo:function(){va
r scroller=this.display.scroller,co=scrollerCutOff;return{left:scroller.scrollLe
ft,top:scroller.scrollTop,height:scroller.scrollHeight-co,width:scroller.scrollW
idth-co,clientHeight:scroller.clientHeight-co,clientWidth:scroller.clientWidth-c
o};},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(r
ange,0),to:null};else if(range.from==null)range={from:range,to:null};if(!range.t
o)range.to=range.from;if(!margin)margin=0;var coords=range;if(range.from.line!=n
ull){this.curOp.scrollToPos={from:range.from,to:range.to,margin:margin};coords={
from:cursorCoords(this,range.from),to:cursorCoords(this,range.to)};} | 422 this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror
-overwrite","");},hasFocus:function(){return document.activeElement==this.displa
y.input;},scrollTo:operation(null,function(x,y){updateScrollPos(this,x,y);}),get
ScrollInfo:function(){var scroller=this.display.scroller,co=scrollerCutOff;retur
n{left:scroller.scrollLeft,top:scroller.scrollTop,height:scroller.scrollHeight-c
o,width:scroller.scrollWidth-co,clientHeight:scroller.clientHeight-co,clientWidt
h:scroller.clientWidth-co};},scrollIntoView:operation(null,function(range,margin
){if(range==null)range={from:this.doc.sel.head,to:null};else if(typeof range=="n
umber")range={from:Pos(range,0),to:null};else if(range.from==null)range={from:ra
nge,to:null};if(!range.to)range.to=range.from;if(!margin)margin=0;var coords=ran
ge;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)};} |
410 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.r
ight),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;} | 423 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.r
ight),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;} |
411 if(width!=null)this.display.wrapper.style.width=interpret(width);if(height!=null
)this.display.wrapper.style.height=interpret(height);if(this.options.lineWrappin
g) | 424 if(width!=null)this.display.wrapper.style.width=interpret(width);if(height!=null
)this.display.wrapper.style.height=interpret(height);if(this.options.lineWrappin
g) |
412 this.display.measureLineCache.length=this.display.measureLineCachePos=0;this.cur
Op.forceUpdate=true;}),operation:function(f){return runInOp(this,f);},refresh:op
eration(null,function(){var badHeight=this.display.cachedTextHeight==null;clearC
aches(this);updateScrollPos(this,this.doc.scrollLeft,this.doc.scrollTop);regChan
ge(this);if(badHeight)estimateLineHeights(this);}),swapDoc:operation(null,functi
on(doc){var old=this.doc;old.cm=null;attachDoc(this,doc);clearCaches(this);reset
Input(this,true);updateScrollPos(this,doc.scrollLeft,doc.scrollTop);signalLater(
this,"swapDoc",this,old);return old;}),getInputField:function(){return this.disp
lay.input;},getWrapperElement:function(){return this.display.wrapper;},getScroll
erElement:function(){return this.display.scroller;},getGutterElement:function(){
return this.display.gutters;}};eventMixin(CodeMirror);var optionHandlers=CodeMir
ror.optionHandlers={};var defaults=CodeMirror.defaults={};function option(name,d
eflt,handle,notOnInit){CodeMirror.defaults[name]=deflt;if(handle)optionHandlers[
name]=notOnInit?function(cm,val,old){if(old!=Init)handle(cm,val,old);}:handle;} | 425 this.display.measureLineCache.length=this.display.measureLineCachePos=0;this.cur
Op.forceUpdate=true;signal(this,"refresh",this);}),operation:function(f){return
runInOp(this,f);},refresh:operation(null,function(){var oldHeight=this.display.c
achedTextHeight;clearCaches(this);updateScrollPos(this,this.doc.scrollLeft,this.
doc.scrollTop);regChange(this);if(oldHeight==null||Math.abs(oldHeight-textHeight
(this.display))>.5) |
413 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,loadMo
de,true);option("indentWithTabs",false);option("smartIndent",true);option("tabSi
ze",4,function(cm){loadMode(cm);clearCaches(cm);regChange(cm);},true);option("sp
ecialChars",/[\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("rtlMoveVi
sually",!windows);option("wholeLineUpdateBefore",true);option("theme","default",
function(cm){themeChanged(cm);guttersChanged(cm);},true);option("keyMap","defaul
t",keyMapChanged);option("extraKeys",null);option("onKeyEvent",null);option("onD
ragEvent",null);option("lineWrapping",false,wrappingChanged,true);option("gutter
s",[],function(cm){setGuttersForLineNumbers(cm.options);guttersChanged(cm);},tru
e);option("fixedGutter",true,function(cm,val){cm.display.gutters.style.left=val?
compensateForHScroll(cm.display)+"px":"0";cm.refresh();},true);option("coverGutt
erNextToScrollbar",false,updateScrollbars,true);option("lineNumbers",false,funct
ion(cm){setGuttersForLineNumbers(cm.options);guttersChanged(cm);},true);option("
firstLineNumber",1,guttersChanged,true);option("lineNumberFormatter",function(in
teger){return integer;},guttersChanged,true);option("showCursorWhenSelecting",fa
lse,updateSelection,true);option("resetSelectionOnContextMenu",true);option("rea
dOnly",false,function(cm,val){if(val=="nocursor"){onBlur(cm);cm.display.input.bl
ur();cm.display.disabled=true;}else{cm.display.disabled=false;if(!val)resetInput
(cm,true);}});option("dragDrop",true);option("cursorBlinkRate",530);option("curs
orScrollMargin",0);option("cursorHeight",1);option("workTime",100);option("workD
elay",100);option("flattenSpans",true);option("pollInterval",100);option("undoDe
pth",40,function(cm,val){cm.doc.history.undoDepth=val;});option("historyEventDel
ay",500);option("viewportMargin",10,function(cm){cm.refresh();},true);option("ma
xHighlightLength",10000,function(cm){loadMode(cm);cm.refresh();},true);option("c
rudeMeasuringFrom",10000);option("moveInputWithCursor",true,function(cm,val){if(
!val)cm.display.inputDiv.style.top=cm.display.inputDiv.style.left=0;});option("t
abindex",null,function(cm,val){cm.display.input.tabIndex=val||"";});option("auto
focus",null);var modes=CodeMirror.modes={},mimeModes=CodeMirror.mimeModes={};Cod
eMirror.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]);} | 426 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);signal
Later(this,"swapDoc",this,old);return old;}),getInputField:function(){return thi
s.display.input;},getWrapperElement:function(){return this.display.wrapper;},get
ScrollerElement:function(){return this.display.scroller;},getGutterElement:funct
ion(){return this.display.gutters;}};eventMixin(CodeMirror);var optionHandlers=C
odeMirror.optionHandlers={};var defaults=CodeMirror.defaults={};function option(
name,deflt,handle,notOnInit){CodeMirror.defaults[name]=deflt;if(handle)optionHan
dlers[name]=notOnInit?function(cm,val,old){if(old!=Init)handle(cm,val,old);}:han
dle;} |
| 427 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,loadMo
de,true);option("indentWithTabs",false);option("smartIndent",true);option("tabSi
ze",4,function(cm){resetModeState(cm);clearCaches(cm);regChange(cm);},true);opti
on("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",defaultSpecialCharPlaceh
older,function(cm){cm.refresh();},true);option("electricChars",true);option("rtl
MoveVisually",!windows);option("wholeLineUpdateBefore",true);option("theme","def
ault",function(cm){themeChanged(cm);guttersChanged(cm);},true);option("keyMap","
default",keyMapChanged);option("extraKeys",null);option("onKeyEvent",null);optio
n("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.lef
t=val?compensateForHScroll(cm.display)+"px":"0";cm.refresh();},true);option("cov
erGutterNextToScrollbar",false,updateScrollbars,true);option("lineNumbers",false
,function(cm){setGuttersForLineNumbers(cm.options);guttersChanged(cm);},true);op
tion("firstLineNumber",1,guttersChanged,true);option("lineNumberFormatter",funct
ion(integer){return integer;},guttersChanged,true);option("showCursorWhenSelecti
ng",false,updateSelection,true);option("resetSelectionOnContextMenu",true);optio
n("readOnly",false,function(cm,val){if(val=="nocursor"){onBlur(cm);cm.display.in
put.blur();cm.display.disabled=true;}else{cm.display.disabled=false;if(!val)rese
tInput(cm,true);}});option("disableInput",false,function(cm,val){if(!val)resetIn
put(cm,true);},true);option("dragDrop",true);option("cursorBlinkRate",530);optio
n("cursorScrollMargin",0);option("cursorHeight",1);option("workTime",100);option
("workDelay",100);option("flattenSpans",true,resetModeState,true);option("addMod
eClass",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("maxHig
hlightLength",10000,resetModeState,true);option("crudeMeasuringFrom",10000);opti
on("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=CodeMir
ror.modes={},mimeModes=CodeMirror.mimeModes={};CodeMirror.defineMode=function(na
me,mode){if(!CodeMirror.defaults.mode&&name!="null")CodeMirror.defaults.mode=nam
e;if(arguments.length>2){mode.dependencies=[];for(var i=2;i<arguments.length;++i
)mode.dependencies.push(arguments[i]);} |
414 modes[name]=mode;};CodeMirror.defineMIME=function(mime,spec){mimeModes[mime]=spe
c;};CodeMirror.resolveMode=function(spec){if(typeof spec=="string"&&mimeModes.ha
sOwnProperty(spec)){spec=mimeModes[spec];}else if(spec&&typeof spec.name=="strin
g"&&mimeModes.hasOwnProperty(spec.name)){var found=mimeModes[spec.name];spec=cre
ateObj(found,spec);spec.name=found.name;}else if(typeof spec=="string"&&/^[\w\-]
+\/[\w\-]+\+xml$/.test(spec)){return CodeMirror.resolveMode("application/xml");} | 428 modes[name]=mode;};CodeMirror.defineMIME=function(mime,spec){mimeModes[mime]=spe
c;};CodeMirror.resolveMode=function(spec){if(typeof spec=="string"&&mimeModes.ha
sOwnProperty(spec)){spec=mimeModes[spec];}else if(spec&&typeof spec.name=="strin
g"&&mimeModes.hasOwnProperty(spec.name)){var found=mimeModes[spec.name];spec=cre
ateObj(found,spec);spec.name=found.name;}else if(typeof spec=="string"&&/^[\w\-]
+\/[\w\-]+\+xml$/.test(spec)){return CodeMirror.resolveMode("application/xml");} |
415 if(typeof spec=="string")return{name:spec};else return spec||{name:"null"};};Cod
eMirror.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.hasOwn
Property(prop))continue;if(modeObj.hasOwnProperty(prop))modeObj["_"+prop]=modeOb
j[prop];modeObj[prop]=exts[prop];}} | 429 if(typeof spec=="string")return{name:spec};else return spec||{name:"null"};};Cod
eMirror.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.hasOwn
Property(prop))continue;if(modeObj.hasOwnProperty(prop))modeObj["_"+prop]=modeOb
j[prop];modeObj[prop]=exts[prop];}} |
416 modeObj.name=spec.name;return modeObj;};CodeMirror.defineMode("null",function(){
return{token:function(stream){stream.skipToEnd();}};});CodeMirror.defineMIME("te
xt/plain","null");var modeExtensions=CodeMirror.modeExtensions={};CodeMirror.ext
endMode=function(mode,properties){var exts=modeExtensions.hasOwnProperty(mode)?m
odeExtensions[mode]:(modeExtensions[mode]={});copyObj(properties,exts);};CodeMir
ror.defineExtension=function(name,func){CodeMirror.prototype[name]=func;};CodeMi
rror.defineDocExtension=function(name,func){Doc.prototype[name]=func;};CodeMirro
r.defineOption=option;var initHooks=[];CodeMirror.defineInitHook=function(f){ini
tHooks.push(f);};var helpers=CodeMirror.helpers={};CodeMirror.registerHelper=fun
ction(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 inst
anceof Array)val=val.concat([]);nstate[n]=val;} | 430 modeObj.name=spec.name;if(spec.helperType)modeObj.helperType=spec.helperType;if(
spec.modeProps)for(var prop in spec.modeProps) |
| 431 modeObj[prop]=spec.modeProps[prop];return modeObj;};CodeMirror.defineMode("null"
,function(){return{token:function(stream){stream.skipToEnd();}};});CodeMirror.de
fineMIME("text/plain","null");var modeExtensions=CodeMirror.modeExtensions={};Co
deMirror.extendMode=function(mode,properties){var exts=modeExtensions.hasOwnProp
erty(mode)?modeExtensions[mode]:(modeExtensions[mode]={});copyObj(properties,ext
s);};CodeMirror.defineExtension=function(name,func){CodeMirror.prototype[name]=f
unc;};CodeMirror.defineDocExtension=function(name,func){Doc.prototype[name]=func
;};CodeMirror.defineOption=option;var initHooks=[];CodeMirror.defineInitHook=fun
ction(f){initHooks.push(f);};var helpers=CodeMirror.helpers={};CodeMirror.regist
erHelper=function(type,name,value){if(!helpers.hasOwnProperty(type))helpers[type
]=CodeMirror[type]={_global:[]};helpers[type][name]=value;};CodeMirror.registerG
lobalHelper=function(type,name,predicate,value){CodeMirror.registerHelper(type,n
ame,value);helpers[type]._global.push({pred:predicate,val:value});};CodeMirror.i
sWordChar=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;} |
417 return nstate;} | 432 return nstate;} |
418 CodeMirror.copyState=copyState;function startState(mode,a1,a2){return mode.start
State?mode.startState(a1,a2):true;} | 433 CodeMirror.copyState=copyState;function startState(mode,a1,a2){return mode.start
State?mode.startState(a1,a2):true;} |
419 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;} | 434 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;} |
420 return info||{mode:mode,state:state};};var commands=CodeMirror.commands={selectA
ll:function(cm){cm.setSelection(Pos(cm.firstLine(),0),Pos(cm.lastLine()));},kill
Line:function(cm){var from=cm.getCursor(true),to=cm.getCursor(false),sel=!posEq(
from,to);if(!sel&&cm.getLine(from.line).length==from.ch) | 435 return info||{mode:mode,state:state};};var commands=CodeMirror.commands={selectA
ll:function(cm){cm.setSelection(Pos(cm.firstLine(),0),Pos(cm.lastLine()));},kill
Line:function(cm){var from=cm.getCursor(true),to=cm.getCursor(false),sel=!posEq(
from,to);if(!sel&&cm.getLine(from.line).length==from.ch) |
421 cm.replaceRange("",from,Pos(from.line+1,0),"+delete");else cm.replaceRange("",fr
om,sel?to:Pos(from.line),"+delete");},deleteLine:function(cm){var l=cm.getCursor
().line;cm.replaceRange("",Pos(l,0),Pos(l),"+delete");},delLineLeft:function(cm)
{var cur=cm.getCursor();cm.replaceRange("",Pos(cur.line,0),cur,"+delete");},undo
:function(cm){cm.undo();},redo:function(cm){cm.redo();},goDocStart:function(cm){
cm.extendSelection(Pos(cm.firstLine(),0));},goDocEnd:function(cm){cm.extendSelec
tion(Pos(cm.lastLine()));},goLineStart:function(cm){cm.extendSelection(lineStart
(cm,cm.getCursor().line));},goLineStartSmart:function(cm){var cur=cm.getCursor()
,start=lineStart(cm,cur.line);var line=cm.getLineHandle(start.line);var order=ge
tOrder(line);if(!order||order[0].level==0){var firstNonWS=Math.max(0,line.text.s
earch(/\S/));var inWS=cur.line==start.line&&cur.ch<=firstNonWS&&cur.ch;cm.extend
Selection(Pos(start.line,inWS?0:firstNonWS));}else cm.extendSelection(start);},g
oLineEnd:function(cm){cm.extendSelection(lineEnd(cm,cm.getCursor().line));},goLi
neRight:function(cm){var top=cm.charCoords(cm.getCursor(),"div").top+5;cm.extend
Selection(cm.coordsChar({left:cm.display.lineDiv.offsetWidth+100,top:top},"div")
);},goLineLeft:function(cm){var top=cm.charCoords(cm.getCursor(),"div").top+5;cm
.extendSelection(cm.coordsChar({left:0,top:top},"div"));},goLineUp:function(cm){
cm.moveV(-1,"line");},goLineDown:function(cm){cm.moveV(1,"line");},goPageUp:func
tion(cm){cm.moveV(-1,"page");},goPageDown:function(cm){cm.moveV(1,"page");},goCh
arLeft:function(cm){cm.moveH(-1,"char");},goCharRight:function(cm){cm.moveH(1,"c
har");},goColumnLeft:function(cm){cm.moveH(-1,"column");},goColumnRight:function
(cm){cm.moveH(1,"column");},goWordLeft:function(cm){cm.moveH(-1,"word");},goGrou
pRight:function(cm){cm.moveH(1,"group");},goGroupLeft:function(cm){cm.moveH(-1,"
group");},goWordRight:function(cm){cm.moveH(1,"word");},delCharBefore:function(c
m){cm.deleteH(-1,"char");},delCharAfter:function(cm){cm.deleteH(1,"char");},delW
ordBefore:function(cm){cm.deleteH(-1,"word");},delWordAfter:function(cm){cm.dele
teH(1,"word");},delGroupBefore:function(cm){cm.deleteH(-1,"group");},delGroupAft
er:function(cm){cm.deleteH(1,"group");},indentAuto:function(cm){cm.indentSelecti
on("smart");},indentMore:function(cm){cm.indentSelection("add");},indentLess:fun
ction(cm){cm.indentSelection("subtract");},insertTab:function(cm){cm.replaceSele
ction("\t","end","+input");},defaultTab:function(cm){if(cm.somethingSelected())c
m.indentSelection("add");else cm.replaceSelection("\t","end","+input");},transpo
seChars:function(cm){var cur=cm.getCursor(),line=cm.getLine(cur.line);if(cur.ch>
0&&cur.ch<line.length-1) | 436 cm.replaceRange("",from,Pos(from.line+1,0),"+delete");else cm.replaceRange("",fr
om,sel?to:Pos(from.line),"+delete");},deleteLine:function(cm){var l=cm.getCursor
().line;cm.replaceRange("",Pos(l,0),Pos(l),"+delete");},delLineLeft:function(cm)
{var cur=cm.getCursor();cm.replaceRange("",Pos(cur.line,0),cur,"+delete");},undo
:function(cm){cm.undo();},redo:function(cm){cm.redo();},goDocStart:function(cm){
cm.extendSelection(Pos(cm.firstLine(),0));},goDocEnd:function(cm){cm.extendSelec
tion(Pos(cm.lastLine()));},goLineStart:function(cm){cm.extendSelection(lineStart
(cm,cm.getCursor().line));},goLineStartSmart:function(cm){var cur=cm.getCursor()
,start=lineStart(cm,cur.line);var line=cm.getLineHandle(start.line);var order=ge
tOrder(line);if(!order||order[0].level==0){var firstNonWS=Math.max(0,line.text.s
earch(/\S/));var inWS=cur.line==start.line&&cur.ch<=firstNonWS&&cur.ch;cm.extend
Selection(Pos(start.line,inWS?0:firstNonWS));}else cm.extendSelection(start);},g
oLineEnd:function(cm){cm.extendSelection(lineEnd(cm,cm.getCursor().line));},goLi
neRight:function(cm){var top=cm.charCoords(cm.getCursor(),"div").top+5;cm.extend
Selection(cm.coordsChar({left:cm.display.lineDiv.offsetWidth+100,top:top},"div")
);},goLineLeft:function(cm){var top=cm.charCoords(cm.getCursor(),"div").top+5;cm
.extendSelection(cm.coordsChar({left:0,top:top},"div"));},goLineUp:function(cm){
cm.moveV(-1,"line");},goLineDown:function(cm){cm.moveV(1,"line");},goPageUp:func
tion(cm){cm.moveV(-1,"page");},goPageDown:function(cm){cm.moveV(1,"page");},goCh
arLeft:function(cm){cm.moveH(-1,"char");},goCharRight:function(cm){cm.moveH(1,"c
har");},goColumnLeft:function(cm){cm.moveH(-1,"column");},goColumnRight:function
(cm){cm.moveH(1,"column");},goWordLeft:function(cm){cm.moveH(-1,"word");},goGrou
pRight:function(cm){cm.moveH(1,"group");},goGroupLeft:function(cm){cm.moveH(-1,"
group");},goWordRight:function(cm){cm.moveH(1,"word");},delCharBefore:function(c
m){cm.deleteH(-1,"char");},delCharAfter:function(cm){cm.deleteH(1,"char");},delW
ordBefore:function(cm){cm.deleteH(-1,"word");},delWordAfter:function(cm){cm.dele
teH(1,"word");},delGroupBefore:function(cm){cm.deleteH(-1,"group");},delGroupAft
er:function(cm){cm.deleteH(1,"group");},indentAuto:function(cm){cm.indentSelecti
on("smart");},indentMore:function(cm){cm.indentSelection("add");},indentLess:fun
ction(cm){cm.indentSelection("subtract");},insertTab:function(cm){cm.replaceSele
ction("\t","end","+input");},defaultTab:function(cm){if(cm.somethingSelected())c
m.indentSelection("add");else cm.replaceSelection("\t","end","+input");},transpo
seChars:function(cm){var cur=cm.getCursor(),line=cm.getLine(cur.line);if(cur.ch>
0&&cur.ch<line.length-1) |
422 cm.replaceRange(line.charAt(cur.ch)+line.charAt(cur.ch-1),Pos(cur.line,cur.ch-1)
,Pos(cur.line,cur.ch+1));},newlineAndIndent:function(cm){operation(cm,function()
{cm.replaceSelection("\n","end","+input");cm.indentLine(cm.getCursor().line,null
,true);})();},toggleOverwrite:function(cm){cm.toggleOverwrite();}};var keyMap=Co
deMirror.keyMap={};keyMap.basic={"Left":"goCharLeft","Right":"goCharRight","Up":
"goLineUp","Down":"goLineDown","End":"goLineEnd","Home":"goLineStartSmart","Page
Up":"goPageUp","PageDown":"goPageDown","Delete":"delCharAfter","Backspace":"delC
harBefore","Shift-Backspace":"delCharBefore","Tab":"defaultTab","Shift-Tab":"ind
entAuto","Enter":"newlineAndIndent","Insert":"toggleOverwrite"};keyMap.pcDefault
={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"red
o","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"go
DocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRi
ght","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroup
Before","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"
findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"rep
laceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore",fallthrough:"basic"};keyMap
.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-
Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"
goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLine
Start","Cmd-Right":"goLineEnd","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backsp
ace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find",
"Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt
-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delL
ineLeft",fallthrough:["basic","emacsy"]};keyMap["default"]=mac?keyMap.macDefault
:keyMap.pcDefault;keyMap.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","C
trl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLef
t","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl
-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWord
After","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeCh
ars"};function getKeyMap(val){if(typeof val=="string")return keyMap[val];else re
turn val;} | 437 cm.replaceRange(line.charAt(cur.ch)+line.charAt(cur.ch-1),Pos(cur.line,cur.ch-1)
,Pos(cur.line,cur.ch+1));},newlineAndIndent:function(cm){operation(cm,function()
{cm.replaceSelection("\n","end","+input");cm.indentLine(cm.getCursor().line,null
,true);})();},toggleOverwrite:function(cm){cm.toggleOverwrite();}};var keyMap=Co
deMirror.keyMap={};keyMap.basic={"Left":"goCharLeft","Right":"goCharRight","Up":
"goLineUp","Down":"goLineDown","End":"goLineEnd","Home":"goLineStartSmart","Page
Up":"goPageUp","PageDown":"goPageDown","Delete":"delCharAfter","Backspace":"delC
harBefore","Shift-Backspace":"delCharBefore","Tab":"defaultTab","Shift-Tab":"ind
entAuto","Enter":"newlineAndIndent","Insert":"toggleOverwrite"};keyMap.pcDefault
={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"red
o","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"go
DocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRi
ght","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroup
Before","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"
findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"rep
laceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore",fallthrough:"basic"};keyMap
.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-
Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"
goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLine
Start","Cmd-Right":"goLineEnd","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backsp
ace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find",
"Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt
-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delL
ineLeft",fallthrough:["basic","emacsy"]};keyMap["default"]=mac?keyMap.macDefault
:keyMap.pcDefault;keyMap.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","C
trl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLef
t","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl
-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWord
After","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeCh
ars"};function getKeyMap(val){if(typeof val=="string")return keyMap[val];else re
turn val;} |
423 function lookupKey(name,maps,handle){function lookup(map){map=getKeyMap(map);var
found=map[name];if(found===false)return"stop";if(found!=null&&handle(found))ret
urn true;if(map.nofallthrough)return"stop";var fallthrough=map.fallthrough;if(fa
llthrough==null)return false;if(Object.prototype.toString.call(fallthrough)!="[o
bject Array]") | 438 function lookupKey(name,maps,handle){function lookup(map){map=getKeyMap(map);var
found=map[name];if(found===false)return"stop";if(found!=null&&handle(found))ret
urn true;if(map.nofallthrough)return"stop";var fallthrough=map.fallthrough;if(fa
llthrough==null)return false;if(Object.prototype.toString.call(fallthrough)!="[o
bject Array]") |
424 return lookup(fallthrough);for(var i=0,e=fallthrough.length;i<e;++i){var done=lo
okup(fallthrough[i]);if(done)return done;} | 439 return lookup(fallthrough);for(var i=0,e=fallthrough.length;i<e;++i){var done=lo
okup(fallthrough[i]);if(done)return done;} |
425 return false;} | 440 return false;} |
426 for(var i=0;i<maps.length;++i){var done=lookup(maps[i]);if(done)return done!="st
op";}} | 441 for(var i=0;i<maps.length;++i){var done=lookup(maps[i]);if(done)return done!="st
op";}} |
427 function isModifierKey(event){var name=keyNames[event.keyCode];return name=="Ctr
l"||name=="Alt"||name=="Shift"||name=="Mod";} | 442 function isModifierKey(event){var name=keyNames[event.keyCode];return name=="Ctr
l"||name=="Alt"||name=="Shift"||name=="Mod";} |
428 function keyName(event,noShift){if(opera&&event.keyCode==34&&event["char"])retur
n false;var name=keyNames[event.keyCode];if(name==null||event.altGraphKey)return
false;if(event.altKey)name="Alt-"+name;if(flipCtrlCmd?event.metaKey:event.ctrlK
ey)name="Ctrl-"+name;if(flipCtrlCmd?event.ctrlKey:event.metaKey)name="Cmd-"+name
;if(!noShift&&event.shiftKey)name="Shift-"+name;return name;} | 443 function keyName(event,noShift){if(opera&&event.keyCode==34&&event["char"])retur
n false;var name=keyNames[event.keyCode];if(name==null||event.altGraphKey)return
false;if(event.altKey)name="Alt-"+name;if(flipCtrlCmd?event.metaKey:event.ctrlK
ey)name="Ctrl-"+name;if(flipCtrlCmd?event.ctrlKey:event.metaKey)name="Cmd-"+name
;if(!noShift&&event.shiftKey)name="Shift-"+name;return name;} |
429 CodeMirror.lookupKey=lookupKey;CodeMirror.isModifierKey=isModifierKey;CodeMirror
.keyName=keyName;CodeMirror.fromTextArea=function(textarea,options){if(!options)
options={};options.value=textarea.value;if(!options.tabindex&&textarea.tabindex) | 444 CodeMirror.lookupKey=lookupKey;CodeMirror.isModifierKey=isModifierKey;CodeMirror
.keyName=keyName;CodeMirror.fromTextArea=function(textarea,options){if(!options)
options={};options.value=textarea.value;if(!options.tabindex&&textarea.tabindex) |
430 options.tabindex=textarea.tabindex;if(!options.placeholder&&textarea.placeholder
) | 445 options.tabindex=textarea.tabindex;if(!options.placeholder&&textarea.placeholder
) |
431 options.placeholder=textarea.placeholder;if(options.autofocus==null){var hasFocu
s=document.body;try{hasFocus=document.activeElement;}catch(e){} | 446 options.placeholder=textarea.placeholder;if(options.autofocus==null){var hasFocu
s=document.body;try{hasFocus=document.activeElement;}catch(e){} |
432 options.autofocus=hasFocus==textarea||textarea.getAttribute("autofocus")!=null&&
hasFocus==document.body;} | 447 options.autofocus=hasFocus==textarea||textarea.getAttribute("autofocus")!=null&&
hasFocus==document.body;} |
433 function save(){textarea.value=cm.getValue();} | 448 function save(){textarea.value=cm.getValue();} |
434 if(textarea.form){on(textarea.form,"submit",save);if(!options.leaveSubmitMethodA
lone){var form=textarea.form,realSubmit=form.submit;try{var wrappedSubmit=form.s
ubmit=function(){save();form.submit=realSubmit;form.submit();form.submit=wrapped
Submit;};}catch(e){}}} | 449 if(textarea.form){on(textarea.form,"submit",save);if(!options.leaveSubmitMethodA
lone){var form=textarea.form,realSubmit=form.submit;try{var wrappedSubmit=form.s
ubmit=function(){save();form.submit=realSubmit;form.submit();form.submit=wrapped
Submit;};}catch(e){}}} |
435 textarea.style.display="none";var cm=CodeMirror(function(node){textarea.parentNo
de.insertBefore(node,textarea.nextSibling);},options);cm.save=save;cm.getTextAre
a=function(){return textarea;};cm.toTextArea=function(){save();textarea.parentNo
de.removeChild(cm.getWrapperElement());textarea.style.display="";if(textarea.for
m){off(textarea.form,"submit",save);if(typeof textarea.form.submit=="function") | 450 textarea.style.display="none";var cm=CodeMirror(function(node){textarea.parentNo
de.insertBefore(node,textarea.nextSibling);},options);cm.save=save;cm.getTextAre
a=function(){return textarea;};cm.toTextArea=function(){save();textarea.parentNo
de.removeChild(cm.getWrapperElement());textarea.style.display="";if(textarea.for
m){off(textarea.form,"submit",save);if(typeof textarea.form.submit=="function") |
436 textarea.form.submit=realSubmit;}};return cm;};function StringStream(string,tabS
ize){this.pos=this.start=0;this.string=string;this.tabSize=tabSize||8;this.lastC
olumnPos=this.lastColumnValue=0;} | 451 textarea.form.submit=realSubmit;}};return cm;};function StringStream(string,tabS
ize){this.pos=this.start=0;this.string=string;this.tabSize=tabSize||8;this.lastC
olumnPos=this.lastColumnValue=0;this.lineStart=0;} |
437 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) | 452 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) |
438 return this.string.charAt(this.pos++);},eat:function(match){var ch=this.string.c
harAt(this.pos);if(typeof match=="string")var ok=ch==match;else var ok=ch&&(matc
h.test?match.test(ch):match(ch));if(ok){++this.pos;return ch;}},eatWhile:functio
n(match){var start=this.pos;while(this.eat(match)){} | 453 return this.string.charAt(this.pos++);},eat:function(match){var ch=this.string.c
harAt(this.pos);if(typeof match=="string")var ok=ch==match;else var ok=ch&&(matc
h.test?match.test(ch):match(ch));if(ok){++this.pos;return ch;}},eatWhile:functio
n(match){var start=this.pos;while(this.eat(match)){} |
439 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;},skipToEn
d:function(){this.pos=this.string.length;},skipTo:function(ch){var found=this.st
ring.indexOf(ch,this.pos);if(found>-1){this.pos=found;return true;}},backUp:func
tion(n){this.pos-=n;},column:function(){if(this.lastColumnPos<this.start){this.l
astColumnValue=countColumn(this.string,this.start,this.tabSize,this.lastColumnPo
s,this.lastColumnValue);this.lastColumnPos=this.start;} | 454 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;},skipToEn
d:function(){this.pos=this.string.length;},skipTo:function(ch){var found=this.st
ring.indexOf(ch,this.pos);if(found>-1){this.pos=found;return true;}},backUp:func
tion(n){this.pos-=n;},column:function(){if(this.lastColumnPos<this.start){this.l
astColumnValue=countColumn(this.string,this.start,this.tabSize,this.lastColumnPo
s,this.lastColumnValue);this.lastColumnPos=this.start;} |
440 return this.lastColumnValue;},indentation:function(){return countColumn(this.str
ing,null,this.tabSize);},match:function(pattern,consume,caseInsensitive){if(type
of pattern=="string"){var cased=function(str){return caseInsensitive?str.toLower
Case():str;};var substr=this.string.substr(this.pos,pattern.length);if(cased(sub
str)==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;} | 455 return this.lastColumnValue-(this.lineStart?countColumn(this.string,this.lineSta
rt,this.tabSize):0);},indentation:function(){return countColumn(this.string,null
,this.tabSize)- |
| 456 (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.st
ring.substr(this.pos,pattern.length);if(cased(substr)==cased(pattern)){if(consum
e!==false)this.pos+=pattern.length;return true;}}else{var match=this.string.slic
e(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 thi
s.string.slice(this.start,this.pos);},hideFirstChars:function(n,inner){this.line
Start+=n;try{return inner();} |
| 457 finally{this.lineStart-=n;}}};CodeMirror.StringStream=StringStream;function Text
Marker(doc,type){this.lines=[];this.type=type;this.doc=doc;} |
441 CodeMirror.TextMarker=TextMarker;eventMixin(TextMarker);TextMarker.prototype.cle
ar=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);} | 458 CodeMirror.TextMarker=TextMarker;eventMixin(TextMarker);TextMarker.prototype.cle
ar=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);} |
442 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(l
ine);line.markedSpans=removeMarkedSpan(line.markedSpans,span);if(span.from!=null
) | 459 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(l
ine);line.markedSpans=removeMarkedSpan(line.markedSpans,span);if(span.from!=null
) |
443 min=lineNo(line);else if(this.collapsed&&!lineIsHidden(this.doc,line)&&cm) | 460 min=lineNo(line);else if(this.collapsed&&!lineIsHidden(this.doc,line)&&cm) |
444 updateLineHeight(line,textHeight(cm.display));} | 461 updateLineHeight(line,textHeight(cm.display));} |
445 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);i
f(len>cm.display.maxLineLength){cm.display.maxLine=visual;cm.display.maxLineLeng
th=len;cm.display.maxLineChanged=true;}} | 462 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);i
f(len>cm.display.maxLineLength){cm.display.maxLine=visual;cm.display.maxLineLeng
th=len;cm.display.maxLineChanged=true;}} |
446 if(min!=null&&cm)regChange(cm,min,max+1);this.lines.length=0;this.explicitlyClea
red=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;if(cm)reChec
kSelection(cm);} | 463 if(min!=null&&cm)regChange(cm,min,max+1);this.lines.length=0;this.explicitlyClea
red=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;if(cm)reChec
kSelection(cm);} |
447 if(withOp)endOperation(cm);};TextMarker.prototype.find=function(){var from,to;fo
r(var i=0;i<this.lines.length;++i){var line=this.lines[i];var span=getMarkedSpan
For(line.markedSpans,this);if(span.from!=null||span.to!=null){var found=lineNo(l
ine);if(span.from!=null)from=Pos(found,span.from);if(span.to!=null)to=Pos(found,
span.to);}} | 464 if(withOp)endOperation(cm);};TextMarker.prototype.find=function(bothSides){var f
rom,to;for(var i=0;i<this.lines.length;++i){var line=this.lines[i];var span=getM
arkedSpanFor(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=P
os(found,span.to);}} |
448 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)re
turn;if(this.type!="bookmark")pos=pos.from;var line=getLine(this.doc,pos.line);c
learCachedMeasurement(cm,line);if(pos.line>=cm.display.showingFrom&&pos.line<cm.
display.showingTo){for(var node=cm.display.lineDiv.firstChild;node;node=node.nex
tSibling)if(node.lineObj==line){if(node.offsetHeight!=line.height)updateLineHeig
ht(line,node.offsetHeight);break;} | 465 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;n
ode=node.nextSibling)if(node.lineObj==line){if(node.offsetHeight!=line.height)up
dateLineHeight(line,node.offsetHeight);break;} |
449 runInOp(cm,function(){cm.curOp.selectionChanged=cm.curOp.forceUpdate=cm.curOp.up
dateMaxLine=true;});}};TextMarker.prototype.attachLine=function(line){if(!this.l
ines.length&&this.doc.cm){var op=this.doc.cm.curOp;if(!op.maybeHiddenMarkers||in
dexOf(op.maybeHiddenMarkers,this)==-1) | 466 runInOp(cm,function(){cm.curOp.selectionChanged=cm.curOp.forceUpdate=cm.curOp.up
dateMaxLine=true;});}};TextMarker.prototype.attachLine=function(line){if(!this.l
ines.length&&this.doc.cm){var op=this.doc.cm.curOp;if(!op.maybeHiddenMarkers||in
dexOf(op.maybeHiddenMarkers,this)==-1) |
450 (op.maybeUnhiddenMarkers||(op.maybeUnhiddenMarkers=[])).push(this);} | 467 (op.maybeUnhiddenMarkers||(op.maybeUnhiddenMarkers=[])).push(this);} |
451 this.lines.push(line);};TextMarker.prototype.detachLine=function(line){this.line
s.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)retur
n markTextShared(doc,from,to,options,type);if(doc.cm&&!doc.cm.curOp)return opera
tion(doc.cm,markText)(doc,from,to,options,type);var marker=new TextMarker(doc,ty
pe);if(posLess(to,from)||posEq(from,to)&&type=="range"&&!(options.inclusiveLeft&
&options.inclusiveRight)) | 468 this.lines.push(line);};TextMarker.prototype.detachLine=function(line){this.line
s.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&&o
ptions.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=ne
w TextMarker(doc,type);if(options)copyObj(options,marker);if(posLess(to,from)||p
osEq(from,to)&&marker.clearWhenEmpty!==false) |
452 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;} | 469 return marker;if(marker.replacedWith){marker.collapsed=true;marker.replacedWith=
elt("span",[marker.replacedWith],"CodeMirror-widget");if(!options.handleMouseEve
nts)marker.replacedWith.ignoreEvents=true;} |
453 if(marker.collapsed)sawCollapsedSpans=true;if(marker.addToHistory) | 470 if(marker.collapsed){if(conflictingCollapsedRange(doc,from.line,from,to,marker)|
|from.line!=to.line&&conflictingCollapsedRange(doc,to.line,from,to,marker)) |
454 addToHistory(doc,{from:from,to:to,origin:"markText"},{head:doc.sel.head,anchor:d
oc.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) | 471 throw new Error("Inserting collapsed marker partially overlapping an existing on
e");sawCollapsedSpans=true;} |
455 updateMaxLine=true;var span={from:null,to:null,marker:marker};size+=line.text.le
ngth;if(curLine==from.line){span.from=from.ch;size-=from.ch;} | 472 if(marker.addToHistory) |
456 if(curLine==to.line){span.to=to.ch;size-=line.text.length-to.ch;} | 473 addToHistory(doc,{from:from,to:to,origin:"markText"},{head:doc.sel.head,anchor:d
oc.sel.anchor},NaN);var curLine=from.line,cm=doc.cm,updateMaxLine;doc.iter(curLi
ne,to.line+1,function(line){if(cm&&marker.collapsed&&!cm.options.lineWrapping&&v
isualLine(doc,line)==cm.display.maxLine) |
457 if(marker.collapsed){if(curLine==to.line)collapsedAtEnd=collapsedSpanAt(line,to.
ch);if(curLine==from.line)collapsedAtStart=collapsedSpanAt(line,from.ch);else up
dateLineHeight(line,0);} | 474 updateMaxLine=true;var span={from:null,to:null,marker:marker};if(curLine==from.l
ine)span.from=from.ch;if(curLine==to.line)span.to=to.ch;if(marker.collapsed&&cur
Line!=from.line)updateLineHeight(line,0);addMarkedSpan(line,span);++curLine;});i
f(marker.collapsed)doc.iter(from.line,to.line+1,function(line){if(lineIsHidden(d
oc,line))updateLineHeight(line,0);});if(marker.clearOnEnter)on(marker,"beforeCur
sorEnter",function(){marker.clear();});if(marker.readOnly){sawReadOnlySpans=true
;if(doc.history.done.length||doc.history.undone.length) |
458 addMarkedSpan(line,span);++curLine;});if(marker.collapsed)doc.iter(from.line,to.
line+1,function(line){if(lineIsHidden(doc,line))updateLineHeight(line,0);});if(m
arker.clearOnEnter)on(marker,"beforeCursorEnter",function(){marker.clear();});if
(marker.readOnly){sawReadOnlySpans=true;if(doc.history.done.length||doc.history.
undone.length) | |
459 doc.clearHistory();} | 475 doc.clearHistory();} |
460 if(marker.collapsed){if(collapsedAtStart!=collapsedAtEnd) | 476 if(marker.collapsed){marker.id=++nextMarkerId;marker.atomic=true;} |
461 throw new Error("Inserting collapsed marker overlapping an existing one");marker
.size=size;marker.atomic=true;} | |
462 if(cm){if(updateMaxLine)cm.curOp.updateMaxLine=true;if(marker.className||marker.
title||marker.startStyle||marker.endStyle||marker.collapsed) | 477 if(cm){if(updateMaxLine)cm.curOp.updateMaxLine=true;if(marker.className||marker.
title||marker.startStyle||marker.endStyle||marker.collapsed) |
463 regChange(cm,from.line,to.line+1);if(marker.atomic)reCheckSelection(cm);} | 478 regChange(cm,from.line,to.line+1);if(marker.atomic)reCheckSelection(cm);} |
464 return marker;} | 479 return marker;} |
465 function SharedTextMarker(markers,primary){this.markers=markers;this.primary=pri
mary;for(var i=0,me=this;i<markers.length;++i){markers[i].parent=this;on(markers
[i],"clear",function(){me.clear();});}} | 480 function SharedTextMarker(markers,primary){this.markers=markers;this.primary=pri
mary;for(var i=0,me=this;i<markers.length;++i){markers[i].parent=this;on(markers
[i],"clear",function(){me.clear();});}} |
466 CodeMirror.SharedTextMarker=SharedTextMarker;eventMixin(SharedTextMarker);Shared
TextMarker.prototype.clear=function(){if(this.explicitlyCleared)return;this.expl
icitlyCleared=true;for(var i=0;i<this.markers.length;++i) | 481 CodeMirror.SharedTextMarker=SharedTextMarker;eventMixin(SharedTextMarker);Shared
TextMarker.prototype.clear=function(){if(this.explicitlyCleared)return;this.expl
icitlyCleared=true;for(var i=0;i<this.markers.length;++i) |
467 this.markers[i].clear();signalLater(this,"clear");};SharedTextMarker.prototype.f
ind=function(){return this.primary.find();};function markTextShared(doc,from,to,
options,type){options=copyObj(options);options.shared=false;var markers=[markTex
t(doc,from,to,options,type)],primary=markers[0];var widget=options.replacedWith;
linkedDocs(doc,function(doc){if(widget)options.replacedWith=widget.cloneNode(tru
e);markers.push(markText(doc,clipPos(doc,from),clipPos(doc,to),options,type));fo
r(var i=0;i<doc.linked.length;++i) | 482 this.markers[i].clear();signalLater(this,"clear");};SharedTextMarker.prototype.f
ind=function(){return this.primary.find();};function markTextShared(doc,from,to,
options,type){options=copyObj(options);options.shared=false;var markers=[markTex
t(doc,from,to,options,type)],primary=markers[0];var widget=options.replacedWith;
linkedDocs(doc,function(doc){if(widget)options.replacedWith=widget.cloneNode(tru
e);markers.push(markText(doc,clipPos(doc,from),clipPos(doc,to),options,type));fo
r(var i=0;i<doc.linked.length;++i) |
468 if(doc.linked[i].isParent)return;primary=lst(markers);});return new SharedTextMa
rker(markers,primary);} | 483 if(doc.linked[i].isParent)return;primary=lst(markers);});return new SharedTextMa
rker(markers,primary);} |
469 function getMarkedSpanFor(spans,marker){if(spans)for(var i=0;i<spans.length;++i)
{var span=spans[i];if(span.marker==marker)return span;}} | 484 function getMarkedSpanFor(spans,marker){if(spans)for(var i=0;i<spans.length;++i)
{var span=spans[i];if(span.marker==marker)return span;}} |
470 function removeMarkedSpan(spans,span){for(var r,i=0;i<spans.length;++i) | 485 function removeMarkedSpan(spans,span){for(var r,i=0;i<spans.length;++i) |
471 if(spans[i]!=span)(r||(r=[])).push(spans[i]);return r;} | 486 if(spans[i]!=span)(r||(r=[])).push(spans[i]);return r;} |
472 function addMarkedSpan(line,span){line.markedSpans=line.markedSpans?line.markedS
pans.concat([span]):[span];span.marker.attachLine(line);} | 487 function addMarkedSpan(line,span){line.markedSpans=line.markedSpans?line.markedS
pans.concat([span]):[span];span.marker.attachLine(line);} |
473 function markedSpansBefore(old,startCh,isInsert){if(old)for(var i=0,nw;i<old.len
gth;++i){var span=old[i],marker=span.marker;var startsBefore=span.from==null||(m
arker.inclusiveLeft?span.from<=startCh:span.from<startCh);if(startsBefore||(mark
er.inclusiveLeft&&marker.inclusiveRight||marker.type=="bookmark")&&span.from==st
artCh&&(!isInsert||!span.marker.insertLeft)){var endsAfter=span.to==null||(marke
r.inclusiveRight?span.to>=startCh:span.to>startCh);(nw||(nw=[])).push({from:span
.from,to:endsAfter?null:span.to,marker:marker});}} | 488 function markedSpansBefore(old,startCh,isInsert){if(old)for(var i=0,nw;i<old.len
gth;++i){var span=old[i],marker=span.marker;var startsBefore=span.from==null||(m
arker.inclusiveLeft?span.from<=startCh:span.from<startCh);if(startsBefore||span.
from==startCh&&marker.type=="bookmark"&&(!isInsert||!span.marker.insertLeft)){va
r endsAfter=span.to==null||(marker.inclusiveRight?span.to>=startCh:span.to>start
Ch);(nw||(nw=[])).push({from:span.from,to:endsAfter?null:span.to,marker:marker})
;}} |
474 return nw;} | 489 return nw;} |
475 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.in
clusiveRight?span.to>=endCh:span.to>endCh);if(endsAfter||marker.type=="bookmark"
&&span.from==endCh&&(!isInsert||span.marker.insertLeft)){var startsBefore=span.f
rom==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-endC
h,marker:marker});}} | 490 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.in
clusiveRight?span.to>=endCh:span.to>endCh);if(endsAfter||span.from==endCh&&marke
r.type=="bookmark"&&(!isInsert||span.marker.insertLeft)){var startsBefore=span.f
rom==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-endC
h,marker:marker});}} |
476 return nw;} | 491 return nw;} |
477 function stretchSpansOverChange(doc,change){var oldFirst=isLine(doc,change.from.
line)&&getLine(doc,change.from.line).markedSpans;var oldLast=isLine(doc,change.t
o.line)&&getLine(doc,change.to.line).markedSpans;if(!oldFirst&&!oldLast)return n
ull;var startCh=change.from.ch,endCh=change.to.ch,isInsert=posEq(change.from,cha
nge.to);var first=markedSpansBefore(oldFirst,startCh,isInsert);var last=markedSp
ansAfter(oldLast,endCh,isInsert);var sameLine=change.text.length==1,offset=lst(c
hange.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.marke
r);if(!found)span.to=startCh;else if(sameLine)span.to=found.to==null?null:found.
to+offset;}}} | 492 function stretchSpansOverChange(doc,change){var oldFirst=isLine(doc,change.from.
line)&&getLine(doc,change.from.line).markedSpans;var oldLast=isLine(doc,change.t
o.line)&&getLine(doc,change.to.line).markedSpans;if(!oldFirst&&!oldLast)return n
ull;var startCh=change.from.ch,endCh=change.to.ch,isInsert=posEq(change.from,cha
nge.to);var first=markedSpansBefore(oldFirst,startCh,isInsert);var last=markedSp
ansAfter(oldLast,endCh,isInsert);var sameLine=change.text.length==1,offset=lst(c
hange.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.marke
r);if(!found)span.to=startCh;else if(sameLine)span.to=found.to==null?null:found.
to+offset;}}} |
478 if(last){for(var i=0;i<last.length;++i){var span=last[i];if(span.to!=null)span.t
o+=offset;if(span.from==null){var found=getMarkedSpanFor(first,span.marker);if(!
found){span.from=offset;if(sameLine)(first||(first=[])).push(span);}}else{span.f
rom+=offset;if(sameLine)(first||(first=[])).push(span);}}} | 493 if(last){for(var i=0;i<last.length;++i){var span=last[i];if(span.to!=null)span.t
o+=offset;if(span.from==null){var found=getMarkedSpanFor(first,span.marker);if(!
found){span.from=offset;if(sameLine)(first||(first=[])).push(span);}}else{span.f
rom+=offset;if(sameLine)(first||(first=[])).push(span);}}} |
479 if(sameLine&&first){for(var i=0;i<first.length;++i) | 494 if(first)first=clearEmptySpans(first);if(last&&last!=first)last=clearEmptySpans(
last);var newMarkers=[first];if(!sameLine){var gap=change.text.length-2,gapMarke
rs;if(gap>0&&first) |
480 if(first[i].from!=null&&first[i].from==first[i].to&&first[i].marker.type!="bookm
ark") | |
481 first.splice(i--,1);if(!first.length)first=null;} | |
482 var newMarkers=[first];if(!sameLine){var gap=change.text.length-2,gapMarkers;if(
gap>0&&first) | |
483 for(var i=0;i<first.length;++i) | 495 for(var i=0;i<first.length;++i) |
484 if(first[i].to==null) | 496 if(first[i].to==null) |
485 (gapMarkers||(gapMarkers=[])).push({from:null,to:null,marker:first[i].marker});f
or(var i=0;i<gap;++i) | 497 (gapMarkers||(gapMarkers=[])).push({from:null,to:null,marker:first[i].marker});f
or(var i=0;i<gap;++i) |
486 newMarkers.push(gapMarkers);newMarkers.push(last);} | 498 newMarkers.push(gapMarkers);newMarkers.push(last);} |
487 return newMarkers;} | 499 return newMarkers;} |
| 500 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) |
| 501 spans.splice(i--,1);} |
| 502 if(!spans.length)return null;return spans;} |
488 function mergeOldSpans(doc,change){var old=getOldSpans(doc,change);var stretched
=stretchSpansOverChange(doc,change);if(!old)return stretched;if(!stretched)retur
n 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=stretch
Cur[j];for(var k=0;k<oldCur.length;++k) | 503 function mergeOldSpans(doc,change){var old=getOldSpans(doc,change);var stretched
=stretchSpansOverChange(doc,change);if(!old)return stretched;if(!stretched)retur
n 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=stretch
Cur[j];for(var k=0;k<oldCur.length;++k) |
489 if(oldCur[k].marker==span.marker)continue spans;oldCur.push(span);}}else if(stre
tchCur){old[i]=stretchCur;}} | 504 if(oldCur[k].marker==span.marker)continue spans;oldCur.push(span);}}else if(stre
tchCur){old[i]=stretchCur;}} |
490 return old;} | 505 return old;} |
491 function removeReadOnlyRanges(doc,from,to){var markers=null;doc.iter(from.line,t
o.line+1,function(line){if(line.markedSpans)for(var i=0;i<line.markedSpans.lengt
h;++i){var mark=line.markedSpans[i].marker;if(mark.readOnly&&(!markers||indexOf(
markers,mark)==-1)) | 506 function removeReadOnlyRanges(doc,from,to){var markers=null;doc.iter(from.line,t
o.line+1,function(line){if(line.markedSpans)for(var i=0;i<line.markedSpans.lengt
h;++i){var mark=line.markedSpans[i].marker;if(mark.readOnly&&(!markers||indexOf(
markers,mark)==-1)) |
492 (markers||(markers=[])).push(mark);}});if(!markers)return null;var parts=[{from:
from,to:to}];for(var i=0;i<markers.length;++i){var mk=markers[i],m=mk.find();for
(var j=0;j<parts.length;++j){var p=parts[j];if(posLess(p.to,m.from)||posLess(m.t
o,p.from))continue;var newParts=[j,1];if(posLess(p.from,m.from)||!mk.inclusiveLe
ft&&posEq(p.from,m.from)) | 507 (markers||(markers=[])).push(mark);}});if(!markers)return null;var parts=[{from:
from,to:to}];for(var i=0;i<markers.length;++i){var mk=markers[i],m=mk.find();for
(var j=0;j<parts.length;++j){var p=parts[j];if(posLess(p.to,m.from)||posLess(m.t
o,p.from))continue;var newParts=[j,1];if(posLess(p.from,m.from)||!mk.inclusiveLe
ft&&posEq(p.from,m.from)) |
493 newParts.push({from:p.from,to:m.from});if(posLess(m.to,p.to)||!mk.inclusiveRight
&&posEq(p.to,m.to)) | 508 newParts.push({from:p.from,to:m.from});if(posLess(m.to,p.to)||!mk.inclusiveRight
&&posEq(p.to,m.to)) |
494 newParts.push({from:m.to,to:p.to});parts.splice.apply(parts,newParts);j+=newPart
s.length-1;}} | 509 newParts.push({from:m.to,to:p.to});parts.splice.apply(parts,newParts);j+=newPart
s.length-1;}} |
495 return parts;} | 510 return parts;} |
496 function collapsedSpanAt(line,ch){var sps=sawCollapsedSpans&&line.markedSpans,fo
und;if(sps)for(var sp,i=0;i<sps.length;++i){sp=sps[i];if(!sp.marker.collapsed)co
ntinue;if((sp.from==null||sp.from<ch)&&(sp.to==null||sp.to>ch)&&(!found||found.w
idth<sp.marker.width)) | 511 function extraLeft(marker){return marker.inclusiveLeft?-1:0;} |
| 512 function extraRight(marker){return marker.inclusiveRight?1:0;} |
| 513 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(aPo
s.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;} |
| 514 function collapsedSpanAtSide(line,start){var sps=sawCollapsedSpans&&line.markedS
pans,found;if(sps)for(var sp,i=0;i<sps.length;++i){sp=sps[i];if(sp.marker.collap
sed&&(start?sp.from:sp.to)==null&&(!found||compareCollapsedMarkers(found,sp.mark
er)<0)) |
497 found=sp.marker;} | 515 found=sp.marker;} |
498 return found;} | 516 return found;} |
499 function collapsedSpanAtStart(line){return collapsedSpanAt(line,-1);} | 517 function collapsedSpanAtStart(line){return collapsedSpanAtSide(line,true);} |
500 function collapsedSpanAtEnd(line){return collapsedSpanAt(line,line.text.length+1
);} | 518 function collapsedSpanAtEnd(line){return collapsedSpanAtSide(line,false);} |
| 519 function conflictingCollapsedRange(doc,lineNo,from,to,marker){var line=getLine(d
oc,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.f
ind(true);var fromCmp=cmp(found.from,from)||extraLeft(sp.marker)-extraLeft(marke
r);var toCmp=cmp(found.to,to)||extraRight(sp.marker)-extraRight(marker);if(fromC
mp>=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) |
| 520 return true;}} |
501 function visualLine(doc,line){var merged;while(merged=collapsedSpanAtStart(line)
) | 521 function visualLine(doc,line){var merged;while(merged=collapsedSpanAtStart(line)
) |
502 line=getLine(doc,merged.find().from.line);return line;} | 522 line=getLine(doc,merged.find().from.line);return line;} |
503 function lineIsHidden(doc,line){var sps=sawCollapsedSpans&&line.markedSpans;if(s
ps)for(var sp,i=0;i<sps.length;++i){sp=sps[i];if(!sp.marker.collapsed)continue;i
f(sp.from==null)return true;if(sp.marker.replacedWith)continue;if(sp.from==0&&sp
.marker.inclusiveLeft&&lineIsHiddenInner(doc,line,sp)) | 523 function lineIsHidden(doc,line){var sps=sawCollapsedSpans&&line.markedSpans;if(s
ps)for(var sp,i=0;i<sps.length;++i){sp=sps[i];if(!sp.marker.collapsed)continue;i
f(sp.from==null)return true;if(sp.marker.replacedWith)continue;if(sp.from==0&&sp
.marker.inclusiveLeft&&lineIsHiddenInner(doc,line,sp)) |
504 return true;}} | 524 return true;}} |
505 function lineIsHiddenInner(doc,line,span){if(span.to==null){var end=span.marker.
find().to,endLine=getLine(doc,end.line);return lineIsHiddenInner(doc,endLine,get
MarkedSpanFor(endLine.markedSpans,span.marker));} | 525 function lineIsHiddenInner(doc,line,span){if(span.to==null){var end=span.marker.
find().to,endLine=getLine(doc,end.line);return lineIsHiddenInner(doc,endLine,get
MarkedSpanFor(endLine.markedSpans,span.marker));} |
506 if(span.marker.inclusiveRight&&span.to==line.text.length) | 526 if(span.marker.inclusiveRight&&span.to==line.text.length) |
507 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.i
nclusiveLeft||span.marker.inclusiveRight)&&lineIsHiddenInner(doc,line,sp))return
true;}} | 527 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)&&line
IsHiddenInner(doc,line,sp))return true;}} |
508 function detachMarkedSpans(line){var spans=line.markedSpans;if(!spans)return;for
(var i=0;i<spans.length;++i) | 528 function detachMarkedSpans(line){var spans=line.markedSpans;if(!spans)return;for
(var i=0;i<spans.length;++i) |
509 spans[i].marker.detachLine(line);line.markedSpans=null;} | 529 spans[i].marker.detachLine(line);line.markedSpans=null;} |
510 function attachMarkedSpans(line,spans){if(!spans)return;for(var i=0;i<spans.leng
th;++i) | 530 function attachMarkedSpans(line,spans){if(!spans)return;for(var i=0;i<spans.leng
th;++i) |
511 spans[i].marker.attachLine(line);line.markedSpans=spans;} | 531 spans[i].marker.attachLine(line);line.markedSpans=spans;} |
512 var LineWidget=CodeMirror.LineWidget=function(cm,node,options){if(options)for(va
r opt in options)if(options.hasOwnProperty(opt)) | 532 var LineWidget=CodeMirror.LineWidget=function(cm,node,options){if(options)for(va
r opt in options)if(options.hasOwnProperty(opt)) |
513 this[opt]=options[opt];this.cm=cm;this.node=node;};eventMixin(LineWidget);functi
on widgetOperation(f){return function(){var withOp=!this.cm.curOp;if(withOp)star
tOperation(this.cm);try{var result=f.apply(this,arguments);} | 533 this[opt]=options[opt];this.cm=cm;this.node=node;};eventMixin(LineWidget);functi
on widgetOperation(f){return function(){var withOp=!this.cm.curOp;if(withOp)star
tOperation(this.cm);try{var result=f.apply(this,arguments);} |
514 finally{if(withOp)endOperation(this.cm);} | 534 finally{if(withOp)endOperation(this.cm);} |
515 return result;};} | 535 return result;};} |
516 LineWidget.prototype.clear=widgetOperation(function(){var ws=this.line.widgets,n
o=lineNo(this.line);if(no==null||!ws)return;for(var i=0;i<ws.length;++i)if(ws[i]
==this)ws.splice(i--,1);if(!ws.length)this.line.widgets=null;var aboveVisible=he
ightAtLine(this.cm,this.line)<this.cm.doc.scrollTop;updateLineHeight(this.line,M
ath.max(0,this.line.height-widgetHeight(this)));if(aboveVisible)addToScrollPos(t
his.cm,0,-this.height);regChange(this.cm,no,no+1);});LineWidget.prototype.change
d=widgetOperation(function(){var oldH=this.height;this.height=null;var diff=widg
etHeight(this)-oldH;if(!diff)return;updateLineHeight(this.line,this.line.height+
diff);var no=lineNo(this.line);regChange(this.cm,no,no+1);});function widgetHeig
ht(widget){if(widget.height!=null)return widget.height;if(!widget.node.parentNod
e||widget.node.parentNode.nodeType!=1) | 536 LineWidget.prototype.clear=widgetOperation(function(){var ws=this.line.widgets,n
o=lineNo(this.line);if(no==null||!ws)return;for(var i=0;i<ws.length;++i)if(ws[i]
==this)ws.splice(i--,1);if(!ws.length)this.line.widgets=null;var aboveVisible=he
ightAtLine(this.cm,this.line)<this.cm.doc.scrollTop;updateLineHeight(this.line,M
ath.max(0,this.line.height-widgetHeight(this)));if(aboveVisible)addToScrollPos(t
his.cm,0,-this.height);regChange(this.cm,no,no+1);});LineWidget.prototype.change
d=widgetOperation(function(){var oldH=this.height;this.height=null;var diff=widg
etHeight(this)-oldH;if(!diff)return;updateLineHeight(this.line,this.line.height+
diff);var no=lineNo(this.line);regChange(this.cm,no,no+1);});function widgetHeig
ht(widget){if(widget.height!=null)return widget.height;if(!widget.node.parentNod
e||widget.node.parentNode.nodeType!=1) |
517 removeChildrenAndAdd(widget.cm.display.measure,elt("div",[widget.node],null,"pos
ition: relative"));return widget.height=widget.node.offsetHeight;} | 537 removeChildrenAndAdd(widget.cm.display.measure,elt("div",[widget.node],null,"pos
ition: relative"));return widget.height=widget.node.offsetHeight;} |
518 function addLineWidget(cm,handle,node,options){var widget=new LineWidget(cm,node
,options);if(widget.noHScroll)cm.display.alignWidgets=true;changeLine(cm,handle,
function(line){var widgets=line.widgets||(line.widgets=[]);if(widget.insertAt==n
ull)widgets.push(widget);else widgets.splice(Math.min(widgets.length-1,Math.max(
0,widget.insertAt)),0,widget);widget.line=line;if(!lineIsHidden(cm.doc,line)||wi
dget.showIfHidden){var aboveVisible=heightAtLine(cm,line)<cm.doc.scrollTop;updat
eLineHeight(line,line.height+widgetHeight(widget));if(aboveVisible)addToScrollPo
s(cm,0,widget.height);} | 538 function addLineWidget(cm,handle,node,options){var widget=new LineWidget(cm,node
,options);if(widget.noHScroll)cm.display.alignWidgets=true;changeLine(cm,handle,
function(line){var widgets=line.widgets||(line.widgets=[]);if(widget.insertAt==n
ull)widgets.push(widget);else widgets.splice(Math.min(widgets.length-1,Math.max(
0,widget.insertAt)),0,widget);widget.line=line;if(!lineIsHidden(cm.doc,line)||wi
dget.showIfHidden){var aboveVisible=heightAtLine(cm,line)<cm.doc.scrollTop;updat
eLineHeight(line,line.height+widgetHeight(widget));if(aboveVisible)addToScrollPo
s(cm,0,widget.height);} |
519 return true;});return widget;} | 539 return true;});return widget;} |
520 var Line=CodeMirror.Line=function(text,markedSpans,estimateHeight){this.text=tex
t;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(li
ne.stateAfter)line.stateAfter=null;if(line.styles)line.styles=null;if(line.order
!=null)line.order=null;detachMarkedSpans(line);attachMarkedSpans(line,markedSpan
s);var estHeight=estimateHeight?estimateHeight(line):1;if(estHeight!=line.height
)updateLineHeight(line,estHeight);} | 540 var Line=CodeMirror.Line=function(text,markedSpans,estimateHeight){this.text=tex
t;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(li
ne.stateAfter)line.stateAfter=null;if(line.styles)line.styles=null;if(line.order
!=null)line.order=null;detachMarkedSpans(line);attachMarkedSpans(line,markedSpan
s);var estHeight=estimateHeight?estimateHeight(line):1;if(estHeight!=line.height
)updateLineHeight(line,estHeight);} |
521 function cleanUpLine(line){line.parent=null;detachMarkedSpans(line);} | 541 function cleanUpLine(line){line.parent=null;detachMarkedSpans(line);} |
522 function runMode(cm,text,mode,state,f,forceToEnd){var flattenSpans=mode.flattenS
pans;if(flattenSpans==null)flattenSpans=cm.options.flattenSpans;var curStart=0,c
urStyle=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(stre
am,state);} | 542 function runMode(cm,text,mode,state,f,forceToEnd){var flattenSpans=mode.flattenS
pans;if(flattenSpans==null)flattenSpans=cm.options.flattenSpans;var curStart=0,c
urStyle=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(stre
am,state);} |
| 543 if(cm.options.addModeClass){var mName=CodeMirror.innerMode(mode,state).mode.name
;if(mName)style="m-"+(style?mName+" "+style:mName);} |
523 if(!flattenSpans||curStyle!=style){if(curStart<stream.start)f(stream.start,curSt
yle);curStart=stream.start;curStyle=style;} | 544 if(!flattenSpans||curStyle!=style){if(curStart<stream.start)f(stream.start,curSt
yle);curStart=stream.start;curStyle=style;} |
524 stream.start=stream.pos;} | 545 stream.start=stream.pos;} |
525 while(curStart<stream.pos){var pos=Math.min(stream.pos,curStart+50000);f(pos,cur
Style);curStart=pos;}} | 546 while(curStart<stream.pos){var pos=Math.min(stream.pos,curStart+50000);f(pos,cur
Style);curStart=pos;}} |
526 function highlightLine(cm,line,state,forceToEnd){var st=[cm.state.modeGen];runMo
de(cm,line.text,cm.doc.mode,state,function(end,style){st.push(end,style);},force
ToEnd);for(var o=0;o<cm.state.overlays.length;++o){var overlay=cm.state.overlays
[o],i=1,at=0;runMode(cm,line.text,overlay.mode,true,function(end,style){var star
t=i;while(at<end){var i_end=st[i];if(i_end>end) | 547 function highlightLine(cm,line,state,forceToEnd){var st=[cm.state.modeGen];runMo
de(cm,line.text,cm.doc.mode,state,function(end,style){st.push(end,style);},force
ToEnd);for(var o=0;o<cm.state.overlays.length;++o){var overlay=cm.state.overlays
[o],i=1,at=0;runMode(cm,line.text,overlay.mode,true,function(end,style){var star
t=i;while(at<end){var i_end=st[i];if(i_end>end) |
527 st.splice(i,1,end,st[i+1],i_end);i+=2;at=Math.min(end,i_end);} | 548 st.splice(i,1,end,st[i+1],i_end);i+=2;at=Math.min(end,i_end);} |
528 if(!style)return;if(overlay.opaque){st.splice(start,i-start,end,style);i=start+2
;}else{for(;start<i;start+=2){var cur=st[start+1];st[start+1]=cur?cur+" "+style:
style;}}});} | 549 if(!style)return;if(overlay.opaque){st.splice(start,i-start,end,style);i=start+2
;}else{for(;start<i;start+=2){var cur=st[start+1];st[start+1]=cur?cur+" "+style:
style;}}});} |
529 return st;} | 550 return st;} |
530 function getLineStyles(cm,line){if(!line.styles||line.styles[0]!=cm.state.modeGe
n) | 551 function getLineStyles(cm,line){if(!line.styles||line.styles[0]!=cm.state.modeGe
n) |
531 line.styles=highlightLine(cm,line,line.stateAfter=getStateBefore(cm,lineNo(line)
));return line.styles;} | 552 line.styles=highlightLine(cm,line,line.stateAfter=getStateBefore(cm,lineNo(line)
));return line.styles;} |
532 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.o
ptions.maxHighlightLength){mode.token(stream,state);stream.start=stream.pos;}} | 553 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.o
ptions.maxHighlightLength){mode.token(stream,state);stream.start=stream.pos;}} |
533 var styleToClassCache={};function interpretTokenStyle(style,builder){if(!style)r
eturn 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(builde
r[prop]==null) | 554 var styleToClassCache={},styleToClassCacheWithMode={};function interpretTokenSty
le(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) |
534 builder[prop]=lineClass[2];else if(!(new RegExp("(?:^|\s)"+lineClass[2]+"(?:$|\s
)")).test(builder[prop])) | 555 builder[prop]=lineClass[2];else if(!(new RegExp("(?:^|\s)"+lineClass[2]+"(?:$|\s
)")).test(builder[prop])) |
535 builder[prop]+=" "+lineClass[2];} | 556 builder[prop]+=" "+lineClass[2];} |
536 return styleToClassCache[style]||(styleToClassCache[style]="cm-"+style.replace(/
+/g," cm-"));} | 557 if(/^\s*$/.test(style))return null;var cache=builder.cm.options.addModeClass?sty
leToClassCacheWithMode:styleToClassCache;return cache[style]||(cache[style]=styl
e.replace(/\S+/g,"cm-$&"));} |
537 function buildLineContent(cm,realLine,measure,copyWidgets){var merged,line=realL
ine,empty=true;while(merged=collapsedSpanAtStart(line)) | 558 function buildLineContent(cm,realLine,measure,copyWidgets){var merged,line=realL
ine,empty=true;while(merged=collapsedSpanAtStart(line)) |
538 line=getLine(cm.doc,merged.find().from.line);var builder={pre:elt("pre"),col:0,p
os:0,measure:null,measuredSomething:false,cm:cm,copyWidgets:copyWidgets};do{if(l
ine.text)empty=false;builder.measure=line==realLine&&measure;builder.pos=0;build
er.addToken=builder.measure?buildTokenMeasure:buildToken;if((ie||webkit)&&cm.get
Option("lineWrapping")) | 559 line=getLine(cm.doc,merged.find().from.line);var builder={pre:elt("pre"),col:0,p
os:0,measure:null,measuredSomething:false,cm:cm,copyWidgets:copyWidgets};do{if(l
ine.text)empty=false;builder.measure=line==realLine&&measure;builder.pos=0;build
er.addToken=builder.measure?buildTokenMeasure:buildToken;if((old_ie||webkit)&&cm
.getOption("lineWrapping")) |
539 builder.addToken=buildTokenSplitSpaces(builder.addToken);var next=insertLineCont
ent(line,builder,getLineStyles(cm,line));if(measure&&line==realLine&&!builder.me
asuredSomething){measure[0]=builder.pre.appendChild(zeroWidthElement(cm.display.
measure));builder.measuredSomething=true;} | 560 builder.addToken=buildTokenSplitSpaces(builder.addToken);var next=insertLineCont
ent(line,builder,getLineStyles(cm,line));if(measure&&line==realLine&&!builder.me
asuredSomething){measure[0]=builder.pre.appendChild(zeroWidthElement(cm.display.
measure));builder.measuredSomething=true;} |
540 if(next)line=getLine(cm.doc,next.to.line);}while(next);if(measure&&!builder.meas
uredSomething&&!measure[0]) | 561 if(next)line=getLine(cm.doc,next.to.line);}while(next);if(measure&&!builder.meas
uredSomething&&!measure[0]) |
541 measure[0]=builder.pre.appendChild(empty?elt("span","\u00a0"):zeroWidthElement(c
m.display.measure));if(!builder.pre.firstChild&&!lineIsHidden(cm.doc,realLine)) | 562 measure[0]=builder.pre.appendChild(empty?elt("span","\u00a0"):zeroWidthElement(c
m.display.measure));if(!builder.pre.firstChild&&!lineIsHidden(cm.doc,realLine)) |
542 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==o
rder[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.i
nsertBefore(span.measureRight=zeroWidthElement(cm.display.measure),span.nextSibl
ing);}} | 563 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);}} |
543 var textClass=builder.textClass?builder.textClass+" "+(realLine.textClass||""):r
ealLine.textClass;if(textClass)builder.pre.className=textClass;signal(cm,"render
Line",cm,realLine,builder.pre);return builder;} | 564 var textClass=builder.textClass?builder.textClass+" "+(realLine.textClass||""):r
ealLine.textClass;if(textClass)builder.pre.className=textClass;signal(cm,"render
Line",cm,realLine,builder.pre);return builder;} |
544 function defaultSpecialCharPlaceholder(ch){var token=elt("span","\u2022","cm-inv
alidchar");token.title="\\u"+ch.charCodeAt(0).toString(16);return token;} | 565 function defaultSpecialCharPlaceholder(ch){var token=elt("span","\u2022","cm-inv
alidchar");token.title="\\u"+ch.charCodeAt(0).toString(16);return token;} |
545 function buildToken(builder,text,style,startStyle,endStyle,title){if(!text)retur
n;var special=builder.cm.options.specialChars;if(!special.test(text)){builder.co
l+=text.length;var content=document.createTextNode(text);}else{var content=docum
ent.createDocumentFragment(),pos=0;while(true){special.lastIndex=pos;var m=speci
al.exec(text);var skipped=m?m.index-pos:text.length-pos;if(skipped){content.appe
ndChild(document.createTextNode(text.slice(pos,pos+skipped)));builder.col+=skipp
ed;} | 566 function buildToken(builder,text,style,startStyle,endStyle,title){if(!text)retur
n;var special=builder.cm.options.specialChars;if(!special.test(text)){builder.co
l+=text.length;var content=document.createTextNode(text);}else{var content=docum
ent.createDocumentFragment(),pos=0;while(true){special.lastIndex=pos;var m=speci
al.exec(text);var skipped=m?m.index-pos:text.length-pos;if(skipped){content.appe
ndChild(document.createTextNode(text.slice(pos,pos+skipped)));builder.col+=skipp
ed;} |
546 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(ta
bWidth),"cm-tab"));builder.col+=tabWidth;}else{var token=builder.cm.options.spec
ialCharPlaceholder(m[0]);content.appendChild(token);builder.col+=1;}}} | 567 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(ta
bWidth),"cm-tab"));builder.col+=tabWidth;}else{var token=builder.cm.options.spec
ialCharPlaceholder(m[0]);content.appendChild(token);builder.col+=1;}}} |
547 if(style||startStyle||endStyle||builder.measure){var fullStyle=style||"";if(star
tStyle)fullStyle+=startStyle;if(endStyle)fullStyle+=endStyle;var token=elt("span
",[content],fullStyle);if(title)token.title=title;return builder.pre.appendChild
(token);} | 568 if(style||startStyle||endStyle||builder.measure){var fullStyle=style||"";if(star
tStyle)fullStyle+=startStyle;if(endStyle)fullStyle+=endStyle;var token=elt("span
",[content],fullStyle);if(title)token.title=title;return builder.pre.appendChild
(token);} |
548 builder.pre.appendChild(content);} | 569 builder.pre.appendChild(content);} |
549 function buildTokenMeasure(builder,text,style,startStyle,endStyle){var wrapping=
builder.cm.options.lineWrapping;for(var i=0;i<text.length;++i){var ch=text.charA
t(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.appendChi
ld(elt("wbr"));} | 570 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.sli
ce(i,to);i=to-1;if(i&&wrapping&&spanAffectsWrapping(text,i)) |
550 var old=builder.measure[builder.pos];var span=builder.measure[builder.pos]=build
Token(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))) | 571 builder.pre.appendChild(elt("wbr"));var old=builder.measure[builder.pos];var spa
n=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&&wrapp
ing&&ch==" "&&i&&!/\s/.test(text.charAt(i-1))&&i<text.length-1&&!/\s/.test(text.
charAt(i+1))) |
551 span.style.whiteSpace="normal";builder.pos+=ch.length;} | 572 span.style.whiteSpace="normal";builder.pos+=ch.length;} |
552 if(text.length)builder.measuredSomething=true;} | 573 if(text.length)builder.measuredSomething=true;} |
553 function buildTokenSplitSpaces(inner){function split(old){var out=" ";for(var i=
0;i<old.length-2;++i)out+=i%2?" ":"\u00a0";out+=" ";return out;} | 574 function buildTokenSplitSpaces(inner){function split(old){var out=" ";for(var i=
0;i<old.length-2;++i)out+=i%2?" ":"\u00a0";out+=" ";return out;} |
554 return function(builder,text,style,startStyle,endStyle,title){return inner(build
er,text.replace(/ {3,}/g,split),style,startStyle,endStyle,title);};} | 575 return function(builder,text,style,startStyle,endStyle,title){return inner(build
er,text.replace(/ {3,}/g,split),style,startStyle,endStyle,title);};} |
555 function buildCollapsedSpan(builder,size,marker,ignoreWidget){var widget=!ignore
Widget&&marker.replacedWith;if(widget){if(builder.copyWidgets)widget=widget.clon
eNode(true);builder.pre.appendChild(widget);if(builder.measure){if(size){builder
.measure[builder.pos]=widget;}else{var elt=zeroWidthElement(builder.cm.display.m
easure);if(marker.type=="bookmark"&&!marker.insertLeft) | 576 function buildCollapsedSpan(builder,size,marker,ignoreWidget){var widget=!ignore
Widget&&marker.replacedWith;if(widget){if(builder.copyWidgets)widget=widget.clon
eNode(true);builder.pre.appendChild(widget);if(builder.measure){if(size){builder
.measure[builder.pos]=widget;}else{var elt=zeroWidthElement(builder.cm.display.m
easure);if(marker.type=="bookmark"&&!marker.insertLeft) |
556 builder.measure[builder.pos]=builder.pre.appendChild(elt);else if(builder.measur
e[builder.pos]) | 577 builder.measure[builder.pos]=builder.pre.appendChild(elt);else if(builder.measur
e[builder.pos]) |
557 return;else | 578 return;else |
558 builder.measure[builder.pos]=builder.pre.insertBefore(elt,widget);} | 579 builder.measure[builder.pos]=builder.pre.insertBefore(elt,widget);} |
559 builder.measuredSomething=true;}} | 580 builder.measuredSomething=true;}} |
560 builder.pos+=size;} | 581 builder.pos+=size;} |
561 function insertLineContent(line,builder,styles){var spans=line.markedSpans,allTe
xt=line.text,at=0;if(!spans){for(var i=1;i<styles.length;i+=2) | 582 function insertLineContent(line,builder,styles){var spans=line.markedSpans,allTe
xt=line.text,at=0;if(!spans){for(var i=1;i<styles.length;i+=2) |
562 builder.addToken(builder,allText.slice(at,at=styles[i]),interpretTokenStyle(styl
es[i+1],builder));return;} | 583 builder.addToken(builder,allText.slice(at,at=styles[i]),interpretTokenStyle(styl
es[i+1],builder));return;} |
563 var len=allText.length,pos=0,i=1,text="",style;var nextChange=0,spanStyle,spanEn
dStyle,spanStartStyle,title,collapsed;for(;;){if(nextChange==pos){spanStyle=span
EndStyle=spanStartStyle=title="";collapsed=null;nextChange=Infinity;var foundBoo
kmarks=[];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="";} | 584 var len=allText.length,pos=0,i=1,text="",style;var nextChange=0,spanStyle,spanEn
dStyle,spanStartStyle,title,collapsed;for(;;){if(nextChange==pos){spanStyle=span
EndStyle=spanStartStyle=title="";collapsed=null;nextChange=Infinity;var foundBoo
kmarks=[];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="";} |
564 if(m.className)spanStyle+=" "+m.className;if(m.startStyle&&sp.from==pos)spanStar
tStyle+=" "+m.startStyle;if(m.endStyle&&sp.to==nextChange)spanEndStyle+=" "+m.en
dStyle;if(m.title&&!title)title=m.title;if(m.collapsed&&(!collapsed||collapsed.m
arker.size<m.size)) | 585 if(m.className)spanStyle+=" "+m.className;if(m.startStyle&&sp.from==pos)spanStar
tStyle+=" "+m.startStyle;if(m.endStyle&&sp.to==nextChange)spanEndStyle+=" "+m.en
dStyle;if(m.title&&!title)title=m.title;if(m.collapsed&&(!collapsed||compareColl
apsedMarkers(collapsed.marker,m)<0)) |
565 collapsed=sp;}else if(sp.from>pos&&nextChange>sp.from){nextChange=sp.from;} | 586 collapsed=sp;}else if(sp.from>pos&&nextChange>sp.from){nextChange=sp.from;} |
566 if(m.type=="bookmark"&&sp.from==pos&&m.replacedWith)foundBookmarks.push(m);} | 587 if(m.type=="bookmark"&&sp.from==pos&&m.replacedWith)foundBookmarks.push(m);} |
567 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();} | 588 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();} |
568 if(!collapsed&&foundBookmarks.length)for(var j=0;j<foundBookmarks.length;++j) | 589 if(!collapsed&&foundBookmarks.length)for(var j=0;j<foundBookmarks.length;++j) |
569 buildCollapsedSpan(builder,0,foundBookmarks[j]);} | 590 buildCollapsedSpan(builder,0,foundBookmarks[j]);} |
570 if(pos>=len)break;var upto=Math.min(len,nextChange);while(true){if(text){var end
=pos+text.length;if(!collapsed){var tokenText=end>upto?text.slice(0,upto-pos):te
xt;builder.addToken(builder,tokenText,style?style+spanStyle:spanStyle,spanStartS
tyle,pos+tokenText.length==nextChange?spanEndStyle:"",title);} | 591 if(pos>=len)break;var upto=Math.min(len,nextChange);while(true){if(text){var end
=pos+text.length;if(!collapsed){var tokenText=end>upto?text.slice(0,upto-pos):te
xt;builder.addToken(builder,tokenText,style?style+spanStyle:spanStyle,spanStartS
tyle,pos+tokenText.length==nextChange?spanEndStyle:"",title);} |
571 if(end>=upto){text=text.slice(upto-pos);pos=upto;break;} | 592 if(end>=upto){text=text.slice(upto-pos);pos=upto;break;} |
572 pos=end;spanStartStyle="";} | 593 pos=end;spanStartStyle="";} |
573 text=allText.slice(at,at=styles[i++]);style=interpretTokenStyle(styles[i++],buil
der);}}} | 594 text=allText.slice(at,at=styles[i++]);style=interpretTokenStyle(styles[i++],buil
der);}}} |
574 function updateDoc(doc,change,markedSpans,selAfter,estimateHeight){function span
sFor(n){return markedSpans?markedSpans[n]:null;} | 595 function updateDoc(doc,change,markedSpans,selAfter,estimateHeight){function span
sFor(n){return markedSpans?markedSpans[n]:null;} |
575 function update(line,text,spans){updateLine(line,text,spans,estimateHeight);sign
alLater(line,"change",line,change);} | 596 function update(line,text,spans){updateLine(line,text,spans,estimateHeight);sign
alLater(line,"change",line,change);} |
576 var from=change.from,to=change.to,text=change.text;var firstLine=getLine(doc,fro
m.line),lastLine=getLine(doc,to.line);var lastText=lst(text),lastSpans=spansFor(
text.length-1),nlines=to.line-from.line;if(from.ch==0&&to.ch==0&&lastText==""&&(
!doc.cm||doc.cm.options.wholeLineUpdateBefore)){for(var i=0,e=text.length-1,adde
d=[];i<e;++i) | 597 var from=change.from,to=change.to,text=change.text;var firstLine=getLine(doc,fro
m.line),lastLine=getLine(doc,to.line);var lastText=lst(text),lastSpans=spansFor(
text.length-1),nlines=to.line-from.line;if(from.ch==0&&to.ch==0&&lastText==""&&(
!doc.cm||doc.cm.options.wholeLineUpdateBefore)){for(var i=0,e=text.length-1,adde
d=[];i<e;++i) |
577 added.push(new Line(text[i],spansFor(i),estimateHeight));update(lastLine,lastLin
e.text,lastSpans);if(nlines)doc.remove(from.line,nlines);if(added.length)doc.ins
ert(from.line,added);}else if(firstLine==lastLine){if(text.length==1){update(fir
stLine,firstLine.text.slice(0,from.ch)+lastText+firstLine.text.slice(to.ch),last
Spans);}else{for(var added=[],i=1,e=text.length-1;i<e;++i) | 598 added.push(new Line(text[i],spansFor(i),estimateHeight));update(lastLine,lastLin
e.text,lastSpans);if(nlines)doc.remove(from.line,nlines);if(added.length)doc.ins
ert(from.line,added);}else if(firstLine==lastLine){if(text.length==1){update(fir
stLine,firstLine.text.slice(0,from.ch)+lastText+firstLine.text.slice(to.ch),last
Spans);}else{for(var added=[],i=1,e=text.length-1;i<e;++i) |
578 added.push(new Line(text[i],spansFor(i),estimateHeight));added.push(new Line(las
tText+firstLine.text.slice(to.ch),lastSpans,estimateHeight));update(firstLine,fi
rstLine.text.slice(0,from.ch)+text[0],spansFor(0));doc.insert(from.line+1,added)
;}}else if(text.length==1){update(firstLine,firstLine.text.slice(0,from.ch)+text
[0]+lastLine.text.slice(to.ch),spansFor(0));doc.remove(from.line+1,nlines);}else
{update(firstLine,firstLine.text.slice(0,from.ch)+text[0],spansFor(0));update(la
stLine,lastText+lastLine.text.slice(to.ch),lastSpans);for(var i=1,e=text.length-
1,added=[];i<e;++i) | 599 added.push(new Line(text[i],spansFor(i),estimateHeight));added.push(new Line(las
tText+firstLine.text.slice(to.ch),lastSpans,estimateHeight));update(firstLine,fi
rstLine.text.slice(0,from.ch)+text[0],spansFor(0));doc.insert(from.line+1,added)
;}}else if(text.length==1){update(firstLine,firstLine.text.slice(0,from.ch)+text
[0]+lastLine.text.slice(to.ch),spansFor(0));doc.remove(from.line+1,nlines);}else
{update(firstLine,firstLine.text.slice(0,from.ch)+text[0],spansFor(0));update(la
stLine,lastText+lastLine.text.slice(to.ch),lastSpans);for(var i=1,e=text.length-
1,added=[];i<e;++i) |
579 added.push(new Line(text[i],spansFor(i),estimateHeight));if(nlines>1)doc.remove(
from.line+1,nlines-1);doc.insert(from.line+1,added);} | 600 added.push(new Line(text[i],spansFor(i),estimateHeight));if(nlines>1)doc.remove(
from.line+1,nlines-1);doc.insert(from.line+1,added);} |
580 signalLater(doc,"change",doc,change);setSelection(doc,selAfter.anchor,selAfter.h
ead,null,true);} | 601 signalLater(doc,"change",doc,change);setSelection(doc,selAfter.anchor,selAfter.h
ead,null,true);} |
581 function LeafChunk(lines){this.lines=lines;this.parent=null;for(var i=0,e=lines.
length,height=0;i<e;++i){lines[i].parent=this;height+=lines[i].height;} | 602 function LeafChunk(lines){this.lines=lines;this.parent=null;for(var i=0,e=lines.
length,height=0;i<e;++i){lines[i].parent=this;height+=lines[i].height;} |
582 this.height=height;} | 603 this.height=height;} |
583 LeafChunk.prototype={chunkSize:function(){return this.lines.length;},removeInner
:function(at,n){for(var i=at,e=at+n;i<e;++i){var line=this.lines[i];this.height-
=line.height;cleanUpLine(line);signalLater(line,"delete");} | 604 LeafChunk.prototype={chunkSize:function(){return this.lines.length;},removeInner
:function(at,n){for(var i=at,e=at+n;i<e;++i){var line=this.lines[i];this.height-
=line.height;cleanUpLine(line);signalLater(line,"delete");} |
584 this.lines.splice(at,n);},collapse:function(lines){lines.splice.apply(lines,[lin
es.length,0].concat(this.lines));},insertInner:function(at,lines,height){this.he
ight+=height;this.lines=this.lines.slice(0,at).concat(lines).concat(this.lines.s
lice(at));for(var i=0,e=lines.length;i<e;++i)lines[i].parent=this;},iterN:functi
on(at,n,op){for(var e=at+n;at<e;++at) | 605 this.lines.splice(at,n);},collapse:function(lines){lines.splice.apply(lines,[lin
es.length,0].concat(this.lines));},insertInner:function(at,lines,height){this.he
ight+=height;this.lines=this.lines.slice(0,at).concat(lines).concat(this.lines.s
lice(at));for(var i=0,e=lines.length;i<e;++i)lines[i].parent=this;},iterN:functi
on(at,n,op){for(var e=at+n;at<e;++at) |
585 if(op(this.lines[at]))return true;}};function BranchChunk(children){this.childre
n=children;var size=0,height=0;for(var i=0,e=children.length;i<e;++i){var ch=chi
ldren[i];size+=ch.chunkSize();height+=ch.height;ch.parent=this;} | 606 if(op(this.lines[at]))return true;}};function BranchChunk(children){this.childre
n=children;var size=0,height=0;for(var i=0,e=children.length;i<e;++i){var ch=chi
ldren[i];size+=ch.chunkSize();height+=ch.height;ch.parent=this;} |
586 this.size=size;this.height=height;this.parent=null;} | 607 this.size=size;this.height=height;this.parent=null;} |
587 BranchChunk.prototype={chunkSize:function(){return this.size;},removeInner:funct
ion(at,n){this.size-=n;for(var i=0;i<this.children.length;++i){var child=this.ch
ildren[i],sz=child.chunkSize();if(at<sz){var rm=Math.min(n,sz-at),oldHeight=chil
d.height;child.removeInner(at,rm);this.height-=oldHeight-child.height;if(sz==rm)
{this.children.splice(i--,1);child.parent=null;} | 608 BranchChunk.prototype={chunkSize:function(){return this.size;},removeInner:funct
ion(at,n){this.size-=n;for(var i=0;i<this.children.length;++i){var child=this.ch
ildren[i],sz=child.chunkSize();if(at<sz){var rm=Math.min(n,sz-at),oldHeight=chil
d.height;child.removeInner(at,rm);this.height-=oldHeight-child.height;if(sz==rm)
{this.children.splice(i--,1);child.parent=null;} |
588 if((n-=rm)==0)break;at=0;}else at-=sz;} | 609 if((n-=rm)==0)break;at=0;}else at-=sz;} |
589 if(this.size-n<25){var lines=[];this.collapse(lines);this.children=[new LeafChun
k(lines)];this.children[0].parent=this;}},collapse:function(lines){for(var i=0,e
=this.children.length;i<e;++i)this.children[i].collapse(lines);},insertInner:fun
ction(at,lines,height){this.size+=lines.length;this.height+=height;for(var i=0,e
=this.children.length;i<e;++i){var child=this.children[i],sz=child.chunkSize();i
f(at<=sz){child.insertInner(at,lines,height);if(child.lines&&child.lines.length>
50){while(child.lines.length>50){var spilled=child.lines.splice(child.lines.leng
th-25,25);var newleaf=new LeafChunk(spilled);child.height-=newleaf.height;this.c
hildren.splice(i+1,0,newleaf);newleaf.parent=this;} | 610 if(this.size-n<25){var lines=[];this.collapse(lines);this.children=[new LeafChun
k(lines)];this.children[0].parent=this;}},collapse:function(lines){for(var i=0,e
=this.children.length;i<e;++i)this.children[i].collapse(lines);},insertInner:fun
ction(at,lines,height){this.size+=lines.length;this.height+=height;for(var i=0,e
=this.children.length;i<e;++i){var child=this.children[i],sz=child.chunkSize();i
f(at<=sz){child.insertInner(at,lines,height);if(child.lines&&child.lines.length>
50){while(child.lines.length>50){var spilled=child.lines.splice(child.lines.leng
th-25,25);var newleaf=new LeafChunk(spilled);child.height-=newleaf.height;this.c
hildren.splice(i+1,0,newleaf);newleaf.parent=this;} |
590 this.maybeSpill();} | 611 this.maybeSpill();} |
591 break;} | 612 break;} |
592 at-=sz;}},maybeSpill:function(){if(this.children.length<=10)return;var me=this;d
o{var spilled=me.children.splice(me.children.length-5,5);var sibling=new BranchC
hunk(spilled);if(!me.parent){var copy=new BranchChunk(me.children);copy.parent=m
e;me.children=[copy,sibling];me=copy;}else{me.size-=sibling.size;me.height-=sibl
ing.height;var myIndex=indexOf(me.parent.children,me);me.parent.children.splice(
myIndex+1,0,sibling);} | 613 at-=sz;}},maybeSpill:function(){if(this.children.length<=10)return;var me=this;d
o{var spilled=me.children.splice(me.children.length-5,5);var sibling=new BranchC
hunk(spilled);if(!me.parent){var copy=new BranchChunk(me.children);copy.parent=m
e;me.children=[copy,sibling];me=copy;}else{me.size-=sibling.size;me.height-=sibl
ing.height;var myIndex=indexOf(me.parent.children,me);me.parent.children.splice(
myIndex+1,0,sibling);} |
593 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=th
is.children[i],sz=child.chunkSize();if(at<sz){var used=Math.min(n,sz-at);if(chil
d.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 insta
nceof Doc))return new Doc(text,mode,firstLine);if(firstLine==null)firstLine=0;Br
anchChunk.call(this,[new LeafChunk([new Line("",null)])]);this.first=firstLine;t
his.scrollTop=this.scrollLeft=0;this.cantEdit=false;this.history=makeHistory();t
his.cleanGeneration=1;this.frontier=firstLine;var start=Pos(firstLine,0);this.se
l={from:start,to:start,head:start,anchor:start,shift:false,extend:false,goalColu
mn: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 thi
s.iterN(this.first,this.first+this.size,from);},insert:function(at,lines){var he
ight=0;for(var i=0,e=lines.length;i<e;++i)height+=lines[i].height;this.insertInn
er(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.fi
rst+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:split
Lines(code),origin:"setValue"},{head:top,anchor:top},true);},replaceRange:functi
on(code,from,to,origin){from=clipPos(this,from);to=to?clipPos(this,to):from;repl
aceRange(this,code,from,to,origin);},getRange:function(from,to,lineSep){var line
s=getBetween(this,clipPos(this,from),clipPos(this,to));if(lineSep===false)return
lines;return lines.join(lineSep||"\n");},getLine:function(line){var l=this.getL
ineHandle(line);return l&&l.text;},setLine:function(line,text){if(isLine(this,li
ne)) | 614 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=th
is.children[i],sz=child.chunkSize();if(at<sz){var used=Math.min(n,sz-at);if(chil
d.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 insta
nceof Doc))return new Doc(text,mode,firstLine);if(firstLine==null)firstLine=0;Br
anchChunk.call(this,[new LeafChunk([new Line("",null)])]);this.first=firstLine;t
his.scrollTop=this.scrollLeft=0;this.cantEdit=false;this.history=makeHistory();t
his.cleanGeneration=1;this.frontier=firstLine;var start=Pos(firstLine,0);this.se
l={from:start,to:start,head:start,anchor:start,shift:false,extend:false,goalColu
mn: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 thi
s.iterN(this.first,this.first+this.size,from);},insert:function(at,lines){var he
ight=0;for(var i=0,e=lines.length;i<e;++i)height+=lines[i].height;this.insertInn
er(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.fi
rst+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:split
Lines(code),origin:"setValue"},{head:top,anchor:top},true);},replaceRange:functi
on(code,from,to,origin){from=clipPos(this,from);to=to?clipPos(this,to):from;repl
aceRange(this,code,from,to,origin);},getRange:function(from,to,lineSep){var line
s=getBetween(this,clipPos(this,from),clipPos(this,to));if(lineSep===false)return
lines;return lines.join(lineSep||"\n");},getLine:function(line){var l=this.getL
ineHandle(line);return l&&l.text;},setLine:function(line,text){if(isLine(this,li
ne)) |
594 replaceRange(this,text,Pos(line,0),clipPos(this,Pos(line)));},removeLine:functio
n(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)));},getLineHand
le: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);},li
neCount:function(){return this.size;},firstLine:function(){return this.first;},l
astLine:function(){return this.first+this.size-1;},clipPos:function(pos){return
clipPos(this,pos);},getCursor:function(start){var sel=this.sel,pos;if(start==nul
l||start=="head")pos=sel.head;else if(start=="anchor")pos=sel.anchor;else if(sta
rt=="end"||start===false)pos=sel.to;else pos=sel.from;return copyPos(pos);},some
thingSelected: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(th
is,pos,pos);}),setSelection:docOperation(function(anchor,head,bias){setSelection
(this,clipPos(this,anchor),clipPos(this,head||anchor),bias);}),extendSelection:d
ocOperation(function(from,to,bias){extendSelection(this,clipPos(this,from),to&&c
lipPos(this,to),bias);}),getSelection:function(lineSep){return this.getRange(thi
s.sel.from,this.sel.to,lineSep);},replaceSelection:function(code,collapse,origin
){makeChange(this,{from:this.sel.from,to:this.sel.to,text:splitLines(code),origi
n:origin},collapse||"around");},undo:docOperation(function(){makeChangeFromHisto
ry(this,"undo");}),redo:docOperation(function(){makeChangeFromHistory(this,"redo
");}),setExtending:function(val){this.sel.extend=val;},historySize:function(){va
r hist=this.history;return{undo:hist.done.length,redo:hist.undone.length};},clea
rHistory:function(){this.history=makeHistory(this.history.maxGeneration);},markC
lean: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.cl
eanGeneration);},getHistory:function(){return{done:copyHistoryArray(this.history
.done),undone:copyHistoryArray(this.history.undone)};},setHistory:function(histD
ata){var hist=this.history=makeHistory(this.history.maxGeneration);hist.done=his
tData.done.slice(0);hist.undone=histData.undone.slice(0);},markText:function(fro
m,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.inse
rtLeft};pos=clipPos(this,pos);return markText(this,pos,pos,realOpts,"bookmark");
},findMarksAt:function(pos){pos=clipPos(this,pos);var markers=[],spans=getLine(t
his,pos.line).markedSpans;if(spans)for(var i=0;i<spans.length;++i){var span=span
s[i];if((span.from==null||span.from<=pos.ch)&&(span.to==null||span.to>=pos.ch)) | 615 replaceRange(this,text,Pos(line,0),clipPos(this,Pos(line)));},removeLine:functio
n(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)));},getLineHand
le: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);},li
neCount:function(){return this.size;},firstLine:function(){return this.first;},l
astLine:function(){return this.first+this.size-1;},clipPos:function(pos){return
clipPos(this,pos);},getCursor:function(start){var sel=this.sel,pos;if(start==nul
l||start=="head")pos=sel.head;else if(start=="anchor")pos=sel.anchor;else if(sta
rt=="end"||start===false)pos=sel.to;else pos=sel.from;return copyPos(pos);},some
thingSelected: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(th
is,pos,pos);}),setSelection:docOperation(function(anchor,head,bias){setSelection
(this,clipPos(this,anchor),clipPos(this,head||anchor),bias);}),extendSelection:d
ocOperation(function(from,to,bias){extendSelection(this,clipPos(this,from),to&&c
lipPos(this,to),bias);}),getSelection:function(lineSep){return this.getRange(thi
s.sel.from,this.sel.to,lineSep);},replaceSelection:function(code,collapse,origin
){makeChange(this,{from:this.sel.from,to:this.sel.to,text:splitLines(code),origi
n:origin},collapse||"around");},undo:docOperation(function(){makeChangeFromHisto
ry(this,"undo");}),redo:docOperation(function(){makeChangeFromHistory(this,"redo
");}),setExtending:function(val){this.sel.extend=val;},historySize:function(){va
r hist=this.history;return{undo:hist.done.length,redo:hist.undone.length};},clea
rHistory:function(){this.history=makeHistory(this.history.maxGeneration);},markC
lean:function(){this.cleanGeneration=this.changeGeneration(true);},changeGenerat
ion:function(forceSplit){if(forceSplit) |
| 616 this.history.lastOp=this.history.lastOrigin=null;return this.history.generation;
},isClean:function(gen){return this.history.generation==(gen||this.cleanGenerati
on);},getHistory:function(){return{done:copyHistoryArray(this.history.done),undo
ne:copyHistoryArray(this.history.undone)};},setHistory:function(histData){var hi
st=this.history=makeHistory(this.history.maxGeneration);hist.done=histData.done.
slice(0);hist.undone=histData.undone.slice(0);},markText:function(from,to,option
s){return markText(this,clipPos(this,from),clipPos(this,to),options,"range");},s
etBookmark:function(pos,options){var realOpts={replacedWith:options&&(options.no
deType==null?options.widget:options),insertLeft:options&&options.insertLeft,clea
rWhenEmpty:false};pos=clipPos(this,pos);return markText(this,pos,pos,realOpts,"b
ookmark");},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)) |
595 markers.push(span.marker.parent||span.marker);} | 617 markers.push(span.marker.parent||span.marker);} |
596 return markers;},getAllMarks:function(){var markers=[];this.iter(function(line){
var sps=line.markedSpans;if(sps)for(var i=0;i<sps.length;++i) | 618 return markers;},getAllMarks:function(){var markers=[];this.iter(function(line){
var sps=line.markedSpans;if(sps)for(var i=0;i<sps.length;++i) |
597 if(sps[i].from!=null)markers.push(sps[i].marker);});return markers;},posFromInde
x:function(off){var ch,lineNo=this.first;this.iter(function(line){var sz=line.te
xt.length+1;if(sz>off){ch=off;return true;} | 619 if(sps[i].from!=null)markers.push(sps[i].marker);});return markers;},posFromInde
x:function(off){var ch,lineNo=this.first;this.iter(function(line){var sz=line.te
xt.length+1;if(sz>off){ch=off;return true;} |
598 off-=sz;++lineNo;});return clipPos(this,Pos(lineNo,ch));},indexFromPos:function(
coords){coords=clipPos(this,coords);var index=coords.ch;if(coords.line<this.firs
t||coords.ch<0)return 0;this.iter(this.first,coords.line,function(line){index+=l
ine.text.length+1;});return index;},copy:function(copyHistory){var doc=new Doc(g
etLines(this,this.first,this.first+this.size),this.modeOption,this.first);doc.sc
rollTop=this.scrollTop;doc.scrollLeft=this.scrollLeft;doc.sel={from:this.sel.fro
m,to:this.sel.to,head:this.sel.head,anchor:this.sel.anchor,shift:this.sel.shift,
extend:false,goalColumn:this.sel.goalColumn};if(copyHistory){doc.history.undoDep
th=this.history.undoDepth;doc.setHistory(this.getHistory());} | 620 off-=sz;++lineNo;});return clipPos(this,Pos(lineNo,ch));},indexFromPos:function(
coords){coords=clipPos(this,coords);var index=coords.ch;if(coords.line<this.firs
t||coords.ch<0)return 0;this.iter(this.first,coords.line,function(line){index+=l
ine.text.length+1;});return index;},copy:function(copyHistory){var doc=new Doc(g
etLines(this,this.first,this.first+this.size),this.modeOption,this.first);doc.sc
rollTop=this.scrollTop;doc.scrollLeft=this.scrollLeft;doc.sel={from:this.sel.fro
m,to:this.sel.to,head:this.sel.head,anchor:this.sel.anchor,shift:this.sel.shift,
extend:false,goalColumn:this.sel.goalColumn};if(copyHistory){doc.history.undoDep
th=this.history.undoDepth;doc.setHistory(this.getHistory());} |
599 return doc;},linkedDoc:function(options){if(!options)options={};var from=this.fi
rst,to=this.first+this.size;if(options.from!=null&&options.from>from)from=option
s.from;if(options.to!=null&&options.to<to)to=options.to;var copy=new Doc(getLine
s(this,from,to),options.mode||this.modeOption,from);if(options.sharedHist)copy.h
istory=this.history;(this.linked||(this.linked=[])).push({doc:copy,sharedHist:op
tions.sharedHist});copy.linked=[{doc:this,isParent:true,sharedHist:options.share
dHist}];return copy;},unlinkDoc:function(other){if(other instanceof CodeMirror)o
ther=other.doc;if(this.linked)for(var i=0;i<this.linked.length;++i){var link=thi
s.linked[i];if(link.doc!=other)continue;this.linked.splice(i,1);other.unlinkDoc(
this);break;} | 621 return doc;},linkedDoc:function(options){if(!options)options={};var from=this.fi
rst,to=this.first+this.size;if(options.from!=null&&options.from>from)from=option
s.from;if(options.to!=null&&options.to<to)to=options.to;var copy=new Doc(getLine
s(this,from,to),options.mode||this.modeOption,from);if(options.sharedHist)copy.h
istory=this.history;(this.linked||(this.linked=[])).push({doc:copy,sharedHist:op
tions.sharedHist});copy.linked=[{doc:this,isParent:true,sharedHist:options.share
dHist}];return copy;},unlinkDoc:function(other){if(other instanceof CodeMirror)o
ther=other.doc;if(this.linked)for(var i=0;i<this.linked.length;++i){var link=thi
s.linked[i];if(link.doc!=other)continue;this.linked.splice(i,1);other.unlinkDoc(
this);break;} |
600 if(other.history==this.history){var splitIds=[other.id];linkedDocs(other,functio
n(doc){splitIds.push(doc.id);},true);other.history=makeHistory();other.history.d
one=copyHistoryArray(this.history.done,splitIds);other.history.undone=copyHistor
yArray(this.history.undone,splitIds);}},iterLinkedDocs:function(f){linkedDocs(th
is,f);},getMode:function(){return this.mode;},getEditor:function(){return this.c
m;}});Doc.prototype.eachLine=Doc.prototype.iter;var dontDelegate="iter insert re
move copy getEditor".split(" ");for(var prop in Doc.prototype)if(Doc.prototype.h
asOwnProperty(prop)&&indexOf(dontDelegate,prop)<0) | 622 if(other.history==this.history){var splitIds=[other.id];linkedDocs(other,functio
n(doc){splitIds.push(doc.id);},true);other.history=makeHistory();other.history.d
one=copyHistoryArray(this.history.done,splitIds);other.history.undone=copyHistor
yArray(this.history.undone,splitIds);}},iterLinkedDocs:function(f){linkedDocs(th
is,f);},getMode:function(){return this.mode;},getEditor:function(){return this.c
m;}});Doc.prototype.eachLine=Doc.prototype.iter;var dontDelegate="iter insert re
move copy getEditor".split(" ");for(var prop in Doc.prototype)if(Doc.prototype.h
asOwnProperty(prop)&&indexOf(dontDelegate,prop)<0) |
601 CodeMirror.prototype[prop]=(function(method){return function(){return method.app
ly(this.doc,arguments);};})(Doc.prototype[prop]);eventMixin(Doc);function linked
Docs(doc,f,sharedHistOnly){function propagate(doc,skip,sharedHist){if(doc.linked
)for(var i=0;i<doc.linked.length;++i){var rel=doc.linked[i];if(rel.doc==skip)con
tinue;var shared=sharedHist&&rel.sharedHist;if(sharedHistOnly&&!shared)continue;
f(rel.doc,shared);propagate(rel.doc,doc,shared);}} | 623 CodeMirror.prototype[prop]=(function(method){return function(){return method.app
ly(this.doc,arguments);};})(Doc.prototype[prop]);eventMixin(Doc);function linked
Docs(doc,f,sharedHistOnly){function propagate(doc,skip,sharedHist){if(doc.linked
)for(var i=0;i<doc.linked.length;++i){var rel=doc.linked[i];if(rel.doc==skip)con
tinue;var shared=sharedHist&&rel.sharedHist;if(sharedHistOnly&&!shared)continue;
f(rel.doc,shared);propagate(rel.doc,doc,shared);}} |
602 propagate(doc,null,true);} | 624 propagate(doc,null,true);} |
603 function attachDoc(cm,doc){if(doc.cm)throw new Error("This document is already i
n use.");cm.doc=doc;doc.cm=cm;estimateLineHeights(cm);loadMode(cm);if(!cm.option
s.lineWrapping)computeMaxLength(cm);cm.options.mode=doc.modeOption;regChange(cm)
;} | 625 function attachDoc(cm,doc){if(doc.cm)throw new Error("This document is already i
n use.");cm.doc=doc;doc.cm=cm;estimateLineHeights(cm);loadMode(cm);if(!cm.option
s.lineWrapping)computeMaxLength(cm);cm.options.mode=doc.modeOption;regChange(cm)
;} |
604 function getLine(chunk,n){n-=chunk.first;while(!chunk.lines){for(var i=0;;++i){v
ar child=chunk.children[i],sz=child.chunkSize();if(n<sz){chunk=child;break;} | 626 function getLine(chunk,n){n-=chunk.first;while(!chunk.lines){for(var i=0;;++i){v
ar child=chunk.children[i],sz=child.chunkSize();if(n<sz){chunk=child;break;} |
(...skipping 10 matching lines...) Expand all Loading... |
615 return n+i;} | 637 return n+i;} |
616 function heightAtLine(cm,lineObj){lineObj=visualLine(cm.doc,lineObj);var h=0,chu
nk=lineObj.parent;for(var i=0;i<chunk.lines.length;++i){var line=chunk.lines[i];
if(line==lineObj)break;else h+=line.height;} | 638 function heightAtLine(cm,lineObj){lineObj=visualLine(cm.doc,lineObj);var h=0,chu
nk=lineObj.parent;for(var i=0;i<chunk.lines.length;++i){var line=chunk.lines[i];
if(line==lineObj)break;else h+=line.height;} |
617 for(var p=chunk.parent;p;chunk=p,p=chunk.parent){for(var i=0;i<p.children.length
;++i){var cur=p.children[i];if(cur==chunk)break;else h+=cur.height;}} | 639 for(var p=chunk.parent;p;chunk=p,p=chunk.parent){for(var i=0;i<p.children.length
;++i){var cur=p.children[i];if(cur==chunk)break;else h+=cur.height;}} |
618 return h;} | 640 return h;} |
619 function getOrder(line){var order=line.order;if(order==null)order=line.order=bid
iOrdering(line.text);return order;} | 641 function getOrder(line){var order=line.order;if(order==null)order=line.order=bid
iOrdering(line.text);return order;} |
620 function makeHistory(startGen){return{done:[],undone:[],undoDepth:Infinity,lastT
ime:0,lastOp:null,lastOrigin:null,generation:startGen||1,maxGeneration:startGen|
|1};} | 642 function makeHistory(startGen){return{done:[],undone:[],undoDepth:Infinity,lastT
ime:0,lastOp:null,lastOrigin:null,generation:startGen||1,maxGeneration:startGen|
|1};} |
621 function attachLocalSpans(doc,change,from,to){var existing=change["spans_"+doc.i
d],n=0;doc.iter(Math.max(doc.first,from),Math.min(doc.first+doc.size,to),functio
n(line){if(line.markedSpans) | 643 function attachLocalSpans(doc,change,from,to){var existing=change["spans_"+doc.i
d],n=0;doc.iter(Math.max(doc.first,from),Math.min(doc.first+doc.size,to),functio
n(line){if(line.markedSpans) |
622 (existing||(existing=change["spans_"+doc.id]={}))[n]=line.markedSpans;++n;});} | 644 (existing||(existing=change["spans_"+doc.id]={}))[n]=line.markedSpans;++n;});} |
623 function historyChangeFromChange(doc,change){var from={line:change.from.line,ch:
change.from.ch};var histChange={from:from,to:changeEnd(change),text:getBetween(d
oc,change.from,change.to)};attachLocalSpans(doc,histChange,change.from.line,chan
ge.to.line+1);linkedDocs(doc,function(doc){attachLocalSpans(doc,histChange,chang
e.from.line,change.to.line+1);},true);return histChange;} | 645 function historyChangeFromChange(doc,change){var from={line:change.from.line,ch:
change.from.ch};var histChange={from:from,to:changeEnd(change),text:getBetween(d
oc,change.from,change.to)};attachLocalSpans(doc,histChange,change.from.line,chan
ge.to.line+1);linkedDocs(doc,function(doc){attachLocalSpans(doc,histChange,chang
e.from.line,change.to.line+1);},true);return histChange;} |
624 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.c
m&&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(historyChangeFr
omChange(doc,change));} | 646 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.c
m&&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(historyChangeFr
omChange(doc,change));} |
625 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:selAft
er.head};hist.done.push(cur);hist.generation=++hist.maxGeneration;while(hist.don
e.length>hist.undoDepth) | 647 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:selAft
er.head};hist.done.push(cur);while(hist.done.length>hist.undoDepth) |
626 hist.done.shift();} | 648 hist.done.shift();} |
627 hist.lastTime=time;hist.lastOp=opId;hist.lastOrigin=change.origin;} | 649 hist.generation=++hist.maxGeneration;hist.lastTime=time;hist.lastOp=opId;hist.la
stOrigin=change.origin;} |
628 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);
} | 650 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);
} |
629 else if(out)out.push(spans[i]);} | 651 else if(out)out.push(spans[i]);} |
630 return!out?spans:out.length?out:null;} | 652 return!out?spans:out.length?out:null;} |
631 function getOldSpans(doc,change){var found=change["spans_"+doc.id];if(!found)ret
urn null;for(var i=0,nw=[];i<change.text.length;++i) | 653 function getOldSpans(doc,change){var found=change["spans_"+doc.id];if(!found)ret
urn null;for(var i=0,nw=[];i<change.text.length;++i) |
632 nw.push(removeClearedSpans(found[i]));return nw;} | 654 nw.push(removeClearedSpans(found[i]));return nw;} |
633 function copyHistoryArray(events,newGroup){for(var i=0,copy=[];i<events.length;+
+i){var event=events[i],changes=event.changes,newChanges=[];copy.push({changes:n
ewChanges,anchorBefore:event.anchorBefore,headBefore:event.headBefore,anchorAfte
r:event.anchorAfter,headAfter:event.headAfter});for(var j=0;j<changes.length;++j
){var change=changes[j],m;newChanges.push({from:change.from,to:change.to,text:ch
ange.text});if(newGroup)for(var prop in change)if(m=prop.match(/^spans_(\d+)$/))
{if(indexOf(newGroup,Number(m[1]))>-1){lst(newChanges)[prop]=change[prop];delete
change[prop];}}}} | 655 function copyHistoryArray(events,newGroup){for(var i=0,copy=[];i<events.length;+
+i){var event=events[i],changes=event.changes,newChanges=[];copy.push({changes:n
ewChanges,anchorBefore:event.anchorBefore,headBefore:event.headBefore,anchorAfte
r:event.anchorAfter,headAfter:event.headAfter});for(var j=0;j<changes.length;++j
){var change=changes[j],m;newChanges.push({from:change.from,to:change.to,text:ch
ange.text});if(newGroup)for(var prop in change)if(m=prop.match(/^spans_(\d+)$/))
{if(indexOf(newGroup,Number(m[1]))>-1){lst(newChanges)[prop]=change[prop];delete
change[prop];}}}} |
634 return copy;} | 656 return copy;} |
635 function rebaseHistSel(pos,from,to,diff){if(to<pos.line){pos.line+=diff;}else if
(from<pos.line){pos.line=from;pos.ch=0;}} | 657 function rebaseHistSel(pos,from,to,diff){if(to<pos.line){pos.line+=diff;}else if
(from<pos.line){pos.line=from;pos.ch=0;}} |
636 function rebaseHistArray(array,from,to,diff){for(var i=0;i<array.length;++i){var
sub=array[i],ok=true;for(var j=0;j<sub.changes.length;++j){var cur=sub.changes[
j];if(!sub.copied){cur.from=copyPos(cur.from);cur.to=copyPos(cur.to);} | 658 function rebaseHistArray(array,from,to,diff){for(var i=0;i<array.length;++i){var
sub=array[i],ok=true;for(var j=0;j<sub.changes.length;++j){var cur=sub.changes[
j];if(!sub.copied){cur.from=copyPos(cur.from);cur.to=copyPos(cur.to);} |
637 if(to<cur.from.line){cur.from.line+=diff;cur.to.line+=diff;}else if(from<=cur.to
.line){ok=false;break;}} | 659 if(to<cur.from.line){cur.from.line+=diff;cur.to.line+=diff;}else if(from<=cur.to
.line){ok=false;break;}} |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 catch(_e){}}} | 695 catch(_e){}}} |
674 function indexOf(collection,elt){if(collection.indexOf)return collection.indexOf
(elt);for(var i=0,e=collection.length;i<e;++i) | 696 function indexOf(collection,elt){if(collection.indexOf)return collection.indexOf
(elt);for(var i=0,e=collection.length;i<e;++i) |
675 if(collection[i]==elt)return i;return-1;} | 697 if(collection[i]==elt)return i;return-1;} |
676 function createObj(base,props){function Obj(){} | 698 function createObj(base,props){function Obj(){} |
677 Obj.prototype=base;var inst=new Obj();if(props)copyObj(props,inst);return inst;} | 699 Obj.prototype=base;var inst=new Obj();if(props)copyObj(props,inst);return inst;} |
678 function copyObj(obj,target){if(!target)target={};for(var prop in obj)if(obj.has
OwnProperty(prop))target[prop]=obj[prop];return target;} | 700 function copyObj(obj,target){if(!target)target={};for(var prop in obj)if(obj.has
OwnProperty(prop))target[prop]=obj[prop];return target;} |
679 function emptyArray(size){for(var a=[],i=0;i<size;++i)a.push(undefined);return a
;} | 701 function emptyArray(size){for(var a=[],i=0;i<size;++i)a.push(undefined);return a
;} |
680 function bind(f){var args=Array.prototype.slice.call(arguments,1);return functio
n(){return f.apply(null,args);};} | 702 function bind(f){var args=Array.prototype.slice.call(arguments,1);return functio
n(){return f.apply(null,args);};} |
681 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));} | 703 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));} |
682 function isEmpty(obj){for(var n in obj)if(obj.hasOwnProperty(n)&&obj[n])return f
alse;return true;} | 704 function isEmpty(obj){for(var n in obj)if(obj.hasOwnProperty(n)&&obj[n])return f
alse;return true;} |
683 var isExtendingChar=/[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF
\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u0
6DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\u1DC0–\u1DFF\u20D0–\u20FF\uA670-\uA67
2\uA674-\uA67D\uA69F\udc00-\udfff\uFE20–\uFE2F]/;function elt(tag,content,classN
ame,style){var e=document.createElement(tag);if(className)e.className=className;
if(style)e.style.cssText=style;if(typeof content=="string")setTextContent(e,cont
ent);else if(content)for(var i=0;i<content.length;++i)e.appendChild(content[i]);
return e;} | 705 var extendingChars=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u
05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7
\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u0
81b-\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\u
0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u
0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u
0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0
dca\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\u10
39\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u10
8d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u1
7c6\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-\u1b
a5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u
1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2df
f\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80
b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua
9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\u
aab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\u
fe0f\ufe20-\ufe26\uff9e\uff9f]/;function isExtendingChar(ch){return ch.charCodeA
t(0)>=768&&extendingChars.test(ch);} |
| 706 function elt(tag,content,className,style){var e=document.createElement(tag);if(c
lassName)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;} |
684 function removeChildren(e){for(var count=e.childNodes.length;count>0;--count) | 707 function removeChildren(e){for(var count=e.childNodes.length;count>0;--count) |
685 e.removeChild(e.firstChild);return e;} | 708 e.removeChild(e.firstChild);return e;} |
686 function removeChildrenAndAdd(parent,e){return removeChildren(parent).appendChil
d(e);} | 709 function removeChildrenAndAdd(parent,e){return removeChildren(parent).appendChil
d(e);} |
687 function setTextContent(e,str){if(ie_lt9){e.innerHTML="";e.appendChild(document.
createTextNode(str));}else e.textContent=str;} | 710 function setTextContent(e,str){if(ie_lt9){e.innerHTML="";e.appendChild(document.
createTextNode(str));}else e.textContent=str;} |
688 function getRect(node){return node.getBoundingClientRect();} | 711 function getRect(node){return node.getBoundingClientRect();} |
689 CodeMirror.replaceGetRect=function(f){getRect=f;};var dragAndDrop=function(){if(
ie_lt9)return false;var div=elt('div');return"draggable"in div||"dragDrop"in div
;}();function spanAffectsWrapping(){return false;} | 712 CodeMirror.replaceGetRect=function(f){getRect=f;};var dragAndDrop=function(){if(
ie_lt9)return false;var div=elt('div');return"draggable"in div||"dragDrop"in div
;}();function spanAffectsWrapping(){return false;} |
690 if(gecko) | 713 if(gecko) |
691 spanAffectsWrapping=function(str,i){return str.charCodeAt(i-1)==36&&str.charCode
At(i)==39;};else if(safari&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)
) | 714 spanAffectsWrapping=function(str,i){return str.charCodeAt(i-1)==36&&str.charCode
At(i)==39;};else if(safari&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)
) |
692 spanAffectsWrapping=function(str,i){return/\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]
/.test(str.slice(i-1,i+1));};else if(webkit&&/Chrome\/(?:29|[3-9]\d|\d\d\d)\./.t
est(navigator.userAgent)) | 715 spanAffectsWrapping=function(str,i){return/\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]
/.test(str.slice(i-1,i+1));};else if(webkit&&/Chrome\/(?:29|[3-9]\d|\d\d\d)\./.t
est(navigator.userAgent)) |
693 spanAffectsWrapping=function(str,i){var code=str.charCodeAt(i-1);return code>=82
08&&code<=8212;};else if(webkit) | 716 spanAffectsWrapping=function(str,i){var code=str.charCodeAt(i-1);return code>=82
08&&code<=8212;};else if(webkit) |
694 spanAffectsWrapping=function(str,i){if(i>1&&str.charCodeAt(i-1)==45){if(/\w/.tes
t(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;} | 717 spanAffectsWrapping=function(str,i){if(i>1&&str.charCodeAt(i-1)==45){if(/\w/.tes
t(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;} |
695 return/[~!#%&*)=+}\]\\|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\
^&*(_=+{[|><]|…[\w~`@#$%\^&*(_=+{[><]/.test(str.slice(i-1,i+1));};var knownScrol
lbarWidth;function scrollbarWidth(measure){if(knownScrollbarWidth!=null)return k
nownScrollbarWidth;var test=elt("div",null,null,"width: 50px; height: 50px; over
flow-x: scroll");removeChildrenAndAdd(measure,test);if(test.offsetWidth) | 718 return/[~!#%&*)=+}\]\\|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\
^&*(_=+{[|><]|\u2026[\w~`@#$%\^&*(_=+{[><]/.test(str.slice(i-1,i+1));};var known
ScrollbarWidth;function scrollbarWidth(measure){if(knownScrollbarWidth!=null)ret
urn knownScrollbarWidth;var test=elt("div",null,null,"width: 50px; height: 50px;
overflow-x: scroll");removeChildrenAndAdd(measure,test);if(test.offsetWidth) |
696 knownScrollbarWidth=test.offsetHeight-test.clientHeight;return knownScrollbarWid
th||0;} | 719 knownScrollbarWidth=test.offsetHeight-test.clientHeight;return knownScrollbarWid
th||0;} |
697 var zwspSupported;function zeroWidthElement(measure){if(zwspSupported==null){var
test=elt("span","\u200b");removeChildrenAndAdd(measure,elt("span",[test,documen
t.createTextNode("x")]));if(measure.firstChild.offsetHeight!=0) | 720 var zwspSupported;function zeroWidthElement(measure){if(zwspSupported==null){var
test=elt("span","\u200b");removeChildrenAndAdd(measure,elt("span",[test,documen
t.createTextNode("x")]));if(measure.firstChild.offsetHeight!=0) |
698 zwspSupported=test.offsetWidth<=1&&test.offsetHeight>2&&!ie_lt8;} | 721 zwspSupported=test.offsetWidth<=1&&test.offsetHeight>2&&!ie_lt8;} |
699 if(zwspSupported)return elt("span","\u200b");else return elt("span","\u00a0",nul
l,"display: inline-block; width: 1px; margin-right: -1px");} | 722 if(zwspSupported)return elt("span","\u200b");else return elt("span","\u00a0",nul
l,"display: inline-block; width: 1px; margin-right: -1px");} |
700 var splitLines="\n\nb".split(/\n/).length!=3?function(string){var pos=0,result=[
],l=string.length;while(pos<=l){var nl=string.indexOf("\n",pos);if(nl==-1)nl=str
ing.length;var line=string.slice(pos,string.charAt(nl-1)=="\r"?nl-1:nl);var rt=l
ine.indexOf("\r");if(rt!=-1){result.push(line.slice(0,rt));pos+=rt+1;}else{resul
t.push(line);pos=nl+1;}} | 723 var splitLines="\n\nb".split(/\n/).length!=3?function(string){var pos=0,result=[
],l=string.length;while(pos<=l){var nl=string.indexOf("\n",pos);if(nl==-1)nl=str
ing.length;var line=string.slice(pos,string.charAt(nl-1)=="\r"?nl-1:nl);var rt=l
ine.indexOf("\r");if(rt!=-1){result.push(line.slice(0,rt));pos+=rt+1;}else{resul
t.push(line);pos=nl+1;}} |
701 return result;}:function(string){return string.split(/\r\n?|\n/);};CodeMirror.sp
litLines=splitLines;var hasSelection=window.getSelection?function(te){try{return
te.selectionStart!=te.selectionEnd;} | 724 return result;}:function(string){return string.split(/\r\n?|\n/);};CodeMirror.sp
litLines=splitLines;var hasSelection=window.getSelection?function(te){try{return
te.selectionStart!=te.selectionEnd;} |
702 catch(e){return false;}}:function(te){try{var range=te.ownerDocument.selection.c
reateRange();} | 725 catch(e){return false;}}:function(te){try{var range=te.ownerDocument.selection.c
reateRange();} |
703 catch(e){} | 726 catch(e){} |
704 if(!range||range.parentElement()!=te)return false;return range.compareEndPoints(
"StartToEnd",range)!=0;};var hasCopyEvent=(function(){var e=elt("div");if("oncop
y"in e)return true;e.setAttribute("oncopy","return;");return typeof e.oncopy=='f
unction';})();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:"PrintS
crn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",1
27:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:
"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63
234:"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]=Str
ing(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&&p
art.to==from){f(Math.max(part.from,from),Math.min(part.to,to),part.level==1?"rtl
":"ltr");found=true;}} | 727 if(!range||range.parentElement()!=te)return false;return range.compareEndPoints(
"StartToEnd",range)!=0;};var hasCopyEvent=(function(){var e=elt("div");if("oncop
y"in e)return true;e.setAttribute("oncopy","return;");return typeof e.oncopy=='f
unction';})();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:"PrintS
crn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",10
9:"-",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",6
3302:"Insert"};CodeMirror.keyNames=keyNames;(function(){for(var i=0;i<10;i++)key
Names[i+48]=keyNames[i+96]=String(i);for(var i=65;i<=90;i++)keyNames[i]=String.f
romCharCode(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;}} |
705 if(!found)f(from,to,"ltr");} | 728 if(!found)f(from,to,"ltr");} |
706 function bidiLeft(part){return part.level%2?part.to:part.from;} | 729 function bidiLeft(part){return part.level%2?part.to:part.from;} |
707 function bidiRight(part){return part.level%2?part.from:part.to;} | 730 function bidiRight(part){return part.level%2?part.from:part.to;} |
708 function lineLeft(line){var order=getOrder(line);return order?bidiLeft(order[0])
:0;} | 731 function lineLeft(line){var order=getOrder(line);return order?bidiLeft(order[0])
:0;} |
709 function lineRight(line){var order=getOrder(line);if(!order)return line.text.len
gth;return bidiRight(lst(order));} | 732 function lineRight(line){var order=getOrder(line);if(!order)return line.text.len
gth;return bidiRight(lst(order));} |
710 function lineStart(cm,lineN){var line=getLine(cm.doc,lineN);var visual=visualLin
e(cm.doc,line);if(visual!=line)lineN=lineNo(visual);var order=getOrder(visual);v
ar ch=!order?0:order[0].level%2?lineRight(visual):lineLeft(visual);return Pos(li
neN,ch);} | 733 function lineStart(cm,lineN){var line=getLine(cm.doc,lineN);var visual=visualLin
e(cm.doc,line);if(visual!=line)lineN=lineNo(visual);var order=getOrder(visual);v
ar ch=!order?0:order[0].level%2?lineRight(visual):lineLeft(visual);return Pos(li
neN,ch);} |
711 function lineEnd(cm,lineN){var merged,line;while(merged=collapsedSpanAtEnd(line=
getLine(cm.doc,lineN))) | 734 function lineEnd(cm,lineN){var merged,line;while(merged=collapsedSpanAtEnd(line=
getLine(cm.doc,lineN))) |
712 lineN=merged.find().to.line;var order=getOrder(line);var ch=!order?line.text.len
gth:order[0].level%2?lineLeft(line):lineRight(line);return Pos(lineN,ch);} | 735 lineN=merged.find().to.line;var order=getOrder(line);var ch=!order?line.text.len
gth:order[0].level%2?lineLeft(line):lineRight(line);return Pos(lineN,ch);} |
713 function compareBidiLevel(order,a,b){var linedir=order[0].level;if(a==linedir)re
turn true;if(b==linedir)return false;return a<b;} | 736 function compareBidiLevel(order,a,b){var linedir=order[0].level;if(a==linedir)re
turn true;if(b==linedir)return false;return a<b;} |
714 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;} | 737 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((c
ur.from==pos||cur.to==pos)){if(found==null){found=i;}else if(compareBidiLevel(or
der,cur.level,order[found].level)){if(cur.from!=cur.to)bidiOther=found;return i;
}else{if(cur.from!=cur.to)bidiOther=i;return found;}}} |
715 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;}}} | 738 return found;} |
716 bidiOther=null;return found;} | 739 function moveInLine(line,pos,dir,byUnit){if(!byUnit)return pos+dir;do pos+=dir;w
hile(pos>0&&isExtendingChar(line.text.charAt(pos)));return pos;} |
717 function moveInLine(line,pos,dir,byUnit){if(!byUnit)return pos+dir;do pos+=dir;w
hile(pos>0&&isExtendingChar.test(line.text.charAt(pos)));return pos;} | |
718 function moveVisually(line,start,dir,byUnit){var bidi=getOrder(line);if(!bidi)re
turn 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) | 740 function moveVisually(line,start,dir,byUnit){var bidi=getOrder(line);if(!bidi)re
turn 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) |
719 target=moveInLine(line,part.to,-1,byUnit);else | 741 target=moveInLine(line,part.to,-1,byUnit);else |
720 target=moveInLine(line,part.from,1,byUnit);}}} | 742 target=moveInLine(line,part.from,1,byUnit);}}} |
721 function moveLogically(line,start,dir,byUnit){var target=start+dir;if(byUnit)whi
le(target>0&&isExtendingChar.test(line.text.charAt(target)))target+=dir;return t
arget<0||target>line.text.length?null:target;} | 743 function moveLogically(line,start,dir,byUnit){var target=start+dir;if(byUnit)whi
le(target>0&&isExtendingChar(line.text.charAt(target)))target+=dir;return target
<0||target>line.text.length?null:target;} |
722 var bidiOrdering=(function(){var lowTypes="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%
%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLL
LLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLL
LLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL";var arabicTypes="rr
rrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmm
mmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrr
rrrrrrrrrrrrrr";function charType(code){if(code<=0xff)return lowTypes.charAt(cod
e);else if(0x590<=code&&code<=0x5f4)return"R";else if(0x600<=code&&code<=0x6ff)r
eturn arabicTypes.charAt(code-0x600);else if(0x700<=code&&code<=0x8ac)return"r";
else return"L";} | 744 var bidiOrdering=(function(){var lowTypes="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%
%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLL
LLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLL
LLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL";var arabicTypes="rr
rrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmm
mmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrr
rrrrrrrrrrrrrr";function charType(code){if(code<=0xff)return lowTypes.charAt(cod
e);else if(0x590<=code&&code<=0x5f4)return"R";else if(0x600<=code&&code<=0x6ff)r
eturn arabicTypes.charAt(code-0x600);else if(0x700<=code&&code<=0x8ac)return"r";
else return"L";} |
723 var bidiRE=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;var isNeutral=/[stwN]/,is
Strong=/[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) | 745 var bidiRE=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;var isNeutral=/[stwN]/,is
Strong=/[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) |
724 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;} | 746 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;} |
725 for(var i=0,cur=outerType;i<len;++i){var type=types[i];if(type=="1"&&cur=="r")ty
pes[i]="n";else if(isStrong.test(type)){cur=type;if(type=="r")types[i]="R";}} | 747 for(var i=0,cur=outerType;i<len;++i){var type=types[i];if(type=="1"&&cur=="r")ty
pes[i]="n";else if(isStrong.test(type)){cur=type;if(type=="r")types[i]="R";}} |
726 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;} | 748 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;} |
727 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){} | 749 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){} |
728 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;}} | 750 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;}} |
729 for(var i=0,cur=outerType;i<len;++i){var type=types[i];if(cur=="L"&&type=="1")ty
pes[i]="L";else if(isStrong.test(type))cur=type;} | 751 for(var i=0,cur=outerType;i<len;++i){var type=types[i];if(cur=="L"&&type=="1")ty
pes[i]="L";else if(isStrong.test(type))cur=type;} |
730 for(var i=0;i<len;++i){if(isNeutral.test(types[i])){for(var end=i+1;end<len&&isN
eutral.test(types[end]);++end){} | 752 for(var i=0;i<len;++i){if(isNeutral.test(types[i])){for(var end=i+1;end<len&&isN
eutral.test(types[end]);++end){} |
731 var before=(i?types[i-1]:outerType)=="L";var after=(end<len-1?types[end]:outerTy
pe)=="L";var replace=before||after?"L":"R";for(var j=i;j<end;++j)types[j]=replac
e;i=end-1;}} | 753 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;}} |
732 var order=[],m;for(var i=0;i<len;){if(countsAsLeft.test(types[i])){var start=i;f
or(++i;i<len&&countsAsLeft.test(types[i]);++i){} | 754 var order=[],m;for(var i=0;i<len;){if(countsAsLeft.test(types[i])){var start=i;f
or(++i;i<len&&countsAsLeft.test(types[i]);++i){} |
733 order.push({from:start,to:i,level:0});}else{var pos=i,at=order.length;for(++i;i<
len&&types[i]!="L";++i){} | 755 order.push({from:start,to:i,level:0});}else{var pos=i,at=order.length;for(++i;i<
len&&types[i]!="L";++i){} |
734 for(var j=pos;j<i;){if(countsAsNum.test(types[j])){if(pos<j)order.splice(at,0,{f
rom:pos,to:j,level:1});var nstart=j;for(++j;j<i&&countsAsNum.test(types[j]);++j)
{} | 756 for(var j=pos;j<i;){if(countsAsNum.test(types[j])){if(pos<j)order.splice(at,0,{f
rom:pos,to:j,level:1});var nstart=j;for(++j;j<i&&countsAsNum.test(types[j]);++j)
{} |
735 order.splice(at,0,{from:nstart,to:j,level:2});pos=j;}else++j;} | 757 order.splice(at,0,{from:nstart,to:j,level:2});pos=j;}else++j;} |
736 if(pos<i)order.splice(at,0,{from:pos,to:i,level:1});}} | 758 if(pos<i)order.splice(at,0,{from:pos,to:i,level:1});}} |
737 if(order[0].level==1&&(m=str.match(/^\s+/))){order[0].from=m[0].length;order.uns
hift({from:0,to:m[0].length,level:0});} | 759 if(order[0].level==1&&(m=str.match(/^\s+/))){order[0].from=m[0].length;order.uns
hift({from:0,to:m[0].length,level:0});} |
738 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});} | 760 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});} |
739 if(order[0].level!=lst(order).level) | 761 if(order[0].level!=lst(order).level) |
740 order.push({from:len,to:len,level:order[0].level});return order;};})();CodeMirro
r.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.tab
Size||2,hooks=parserConfig.hooks||{},atMediaTypes=parserConfig.atMediaTypes||{},
atMediaFeatures=parserConfig.atMediaFeatures||{},propertyKeywords=parserConfig.p
ropertyKeywords||{},colorKeywords=parserConfig.colorKeywords||{},valueKeywords=p
arserConfig.valueKeywords||{},allowNested=!!parserConfig.allowNested,type=null;f
unction ret(style,tp){type=tp;return style;} | 762 order.push({from:len,to:len,level:order[0].level});return order;};})();CodeMirro
r.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.tab
Size||2,hooks=parserConfig.hooks||{},atMediaTypes=parserConfig.atMediaTypes||{},
atMediaFeatures=parserConfig.atMediaFeatures||{},propertyKeywords=parserConfig.p
ropertyKeywords||{},colorKeywords=parserConfig.colorKeywords||{},valueKeywords=p
arserConfig.valueKeywords||{},allowNested=!!parserConfig.allowNested,type=null;f
unction ret(style,tp){type=tp;return style;} |
741 function tokenBase(stream,state){var ch=stream.next();if(hooks[ch]){var result=h
ooks[ch](stream,state);if(result!==false)return result;} | 763 function tokenBase(stream,state){var ch=stream.next();if(hooks[ch]){var result=h
ooks[ch](stream,state);if(result!==false)return result;} |
742 if(ch=="@"){stream.eatWhile(/[\w\\\-]/);return ret("def",stream.current());} | 764 if(ch=="@"){stream.eatWhile(/[\w\\\-]/);return ret("def",stream.current());} |
743 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);} | 765 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);} |
744 else if(ch=="#"){stream.eatWhile(/[\w\\\-]/);return ret("atom","hash");} | 766 else if(ch=="#"){stream.eatWhile(/[\w\\\-]/);return ret("atom","hash");} |
745 else if(ch=="!"){stream.match(/^\s*\w*/);return ret("keyword","important");} | 767 else if(ch=="!"){stream.match(/^\s*\w*/);return ret("keyword","important");} |
746 else if(/\d/.test(ch)||ch=="."&&stream.eat(/\d/)){stream.eatWhile(/[\w.%]/);retu
rn ret("number","unit");} | 768 else if(/\d/.test(ch)||ch=="."&&stream.eat(/\d/)){stream.eatWhile(/[\w.%]/);retu
rn ret("number","unit");} |
747 else if(ch==="-"){if(/\d/.test(stream.peek())){stream.eatWhile(/[\w.%]/);return
ret("number","unit");}else if(stream.match(/^[^-]+-/)){return ret("meta","meta")
;}} | 769 else if(ch==="-"){if(/\d/.test(stream.peek())){stream.eatWhile(/[\w.%]/);return
ret("number","unit");}else if(stream.match(/^[^-]+-/)){return ret("meta","meta")
;}} |
748 else if(/[,+>*\/]/.test(ch)){return ret(null,"select-op");} | 770 else if(/[,+>*\/]/.test(ch)){return ret(null,"select-op");} |
749 else if(ch=="."&&stream.match(/^-?[_a-z][_a-z0-9-]*/i)){return ret("qualifier","
qualifier");} | 771 else if(ch=="."&&stream.match(/^-?[_a-z][_a-z0-9-]*/i)){return ret("qualifier","
qualifier");} |
750 else if(ch==":"){return ret("operator",ch);} | 772 else if(ch==":"){return ret("operator",ch);} |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 if(ch==='+'||ch==='='){return'operator';} | 1169 if(ch==='+'||ch==='='){return'operator';} |
1148 if(ch==='-'){stream.eat('-');stream.eatWhile(/\w/);return'attribute';} | 1170 if(ch==='-'){stream.eat('-');stream.eatWhile(/\w/);return'attribute';} |
1149 if(/\d/.test(ch)){stream.eatWhile(/\d/);if(!/\w/.test(stream.peek())){return'num
ber';}} | 1171 if(/\d/.test(ch)){stream.eatWhile(/\d/);if(!/\w/.test(stream.peek())){return'num
ber';}} |
1150 stream.eatWhile(/[\w-]/);var cur=stream.current();if(stream.peek()==='='&&/\w+/.
test(cur))return'def';return words.hasOwnProperty(cur)?words[cur]:null;} | 1172 stream.eatWhile(/[\w-]/);var cur=stream.current();if(stream.peek()==='='&&/\w+/.
test(cur))return'def';return words.hasOwnProperty(cur)?words[cur]:null;} |
1151 function tokenString(quote){return function(stream,state){var next,end=false,esc
aped=false;while((next=stream.next())!=null){if(next===quote&&!escaped){end=true
;break;} | 1173 function tokenString(quote){return function(stream,state){var next,end=false,esc
aped=false;while((next=stream.next())!=null){if(next===quote&&!escaped){end=true
;break;} |
1152 if(next==='$'&&!escaped&"e!=='\''){escaped=true;stream.backUp(1);state.token
s.unshift(tokenDollar);break;} | 1174 if(next==='$'&&!escaped&"e!=='\''){escaped=true;stream.backUp(1);state.token
s.unshift(tokenDollar);break;} |
1153 escaped=!escaped&&next==='\\';} | 1175 escaped=!escaped&&next==='\\';} |
1154 if(end||!escaped){state.tokens.shift();} | 1176 if(end||!escaped){state.tokens.shift();} |
1155 return(quote==='`'||quote===')'?'quote':'string');};};var tokenDollar=function(s
tream,state){if(state.tokens.length>1)stream.eat('$');var ch=stream.next(),hungr
y=/\w/;if(ch==='{')hungry=/[^}]/;if(ch==='('){state.tokens[0]=tokenString(')');r
eturn tokenize(stream,state);} | 1177 return(quote==='`'||quote===')'?'quote':'string');};};var tokenDollar=function(s
tream,state){if(state.tokens.length>1)stream.eat('$');var ch=stream.next(),hungr
y=/\w/;if(ch==='{')hungry=/[^}]/;if(ch==='('){state.tokens[0]=tokenString(')');r
eturn tokenize(stream,state);} |
1156 if(!/\d/.test(ch)){stream.eatWhile(hungry);stream.eat('}');} | 1178 if(!/\d/.test(ch)){stream.eatWhile(hungry);stream.eat('}');} |
1157 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 toke
nize(stream,state);}};});CodeMirror.defineMIME('text/x-sh','shell');;WebInspecto
r.CodeMirrorUtils={createTokenizer:function(mimeType) | 1179 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 toke
nize(stream,state);}};});CodeMirror.defineMIME('text/x-sh','shell');;WebInspecto
r.CodeMirrorUtils=function() |
| 1180 {WebInspector.InplaceEditor.call(this);} |
| 1181 WebInspector.CodeMirrorUtils.prototype={editorContent:function(editingContext){r
eturn editingContext.codeMirror.getValue();},_consumeCopy:function(e) |
| 1182 {e.consume();},setUpEditor:function(editingContext) |
| 1183 {var element=editingContext.element;var config=editingContext.config;loadScript(
"CodeMirrorTextEditor.js");editingContext.cssLoadView=new WebInspector.CodeMirro
rCSSLoadView();editingContext.cssLoadView.show(element);WebInspector.setCurrentF
ocusElement(element);element.addEventListener("copy",this._consumeCopy,false);va
r codeMirror=window.CodeMirror(element,{mode:config.mode,lineWrapping:config.lin
eWrapping,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.scrollIntoViewI
fNeeded(false);});editingContext.codeMirror=codeMirror;},closeEditor:function(ed
itingContext) |
| 1184 {editingContext.element.removeEventListener("copy",this._consumeCopy,false);edit
ingContext.cssLoadView.detach();},cancelEditing:function(editingContext) |
| 1185 {editingContext.codeMirror.setValue(editingContext.oldText);},augmentEditingHand
le:function(editingContext,handle) |
| 1186 {function setWidth(editingContext,width) |
| 1187 {var padding=30;var codeMirror=editingContext.codeMirror;codeMirror.getWrapperEl
ement().style.width=(width-codeMirror.getWrapperElement().offsetLeft-padding)+"p
x";codeMirror.refresh();} |
| 1188 handle.codeMirror=editingContext.codeMirror;handle.setWidth=setWidth.bind(null,e
ditingContext);},__proto__:WebInspector.InplaceEditor.prototype} |
| 1189 WebInspector.CodeMirrorUtils.TokenizerFactory=function(){} |
| 1190 WebInspector.CodeMirrorUtils.TokenizerFactory.prototype={createTokenizer:functio
n(mimeType) |
1158 {var mode=CodeMirror.getMode({indentUnit:2},mimeType);var state=CodeMirror.start
State(mode);function tokenize(line,callback) | 1191 {var mode=CodeMirror.getMode({indentUnit:2},mimeType);var state=CodeMirror.start
State(mode);function tokenize(line,callback) |
1159 {var stream=new CodeMirror.StringStream(line);while(!stream.eol()){var style=mod
e.token(stream,state);var value=stream.current();callback(value,style,stream.sta
rt,stream.start+value.length);stream.start=stream.pos;}} | 1192 {var stream=new CodeMirror.StringStream(line);while(!stream.eol()){var style=mod
e.token(stream,state);var value=stream.current();callback(value,style,stream.sta
rt,stream.start+value.length);stream.start=stream.pos;}} |
1160 return tokenize;},convertTokenType:function(tokenType) | 1193 return tokenize;}} |
1161 {if(tokenType.startsWith("js-variable")||tokenType.startsWith("js-property")||to
kenType==="js-def") | 1194 WebInspector.CodeMirrorCSSLoadView=function() |
1162 return"javascript-ident";if(tokenType==="js-string-2") | 1195 {WebInspector.VBox.call(this);this.element.classList.add("hidden");this.register
RequiredCSS("cm/codemirror.css");this.registerRequiredCSS("cm/cmdevtools.css");} |
1163 return"javascript-regexp";if(tokenType==="js-number"||tokenType==="js-comment"||
tokenType==="js-string"||tokenType==="js-keyword") | 1196 WebInspector.CodeMirrorCSSLoadView.prototype={__proto__:WebInspector.VBox.protot
ype};WebInspector.CodeMirrorTextEditor=function(url,delegate) |
1164 return"javascript-"+tokenType.substring("js-".length);if(tokenType==="css-number
") | 1197 {WebInspector.VBox.call(this);this._delegate=delegate;this._url=url;this.registe
rRequiredCSS("cm/codemirror.css");this.registerRequiredCSS("cm/cmdevtools.css");
this._codeMirror=window.CodeMirror(this.element,{lineNumbers:true,gutters:["Code
Mirror-linenumbers"],matchBrackets:true,smartIndent:false,styleSelectedText:true
,electricChars:false,});this._codeMirror._codeMirrorTextEditor=this;CodeMirror.k
eyMap["devtools-common"]={"Left":"goCharLeft","Right":"goCharRight","Up":"goLine
Up","Down":"goLineDown","End":"goLineEnd","Home":"goLineStartSmart","PageUp":"go
PageUp","PageDown":"goPageDown","Delete":"delCharAfter","Backspace":"delCharBefo
re","Tab":"defaultTab","Shift-Tab":"indentLess","Enter":"smartNewlineAndIndent",
"Ctrl-Space":"autocomplete"};CodeMirror.keyMap["devtools-pc"]={"Ctrl-A":"selectA
ll","Ctrl-Z":"undoAndReveal","Shift-Ctrl-Z":"redoAndReveal","Ctrl-Y":"redo","Ctr
l-Home":"goDocStart","Ctrl-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"g
oDocEnd","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLin
eStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":
"delGroupAfter","Ctrl-/":"toggleComment",fallthrough:"devtools-common"};CodeMirr
or.keyMap["devtools-mac"]={"Cmd-A":"selectAll","Cmd-Z":"undoAndReveal","Shift-Cm
d-Z":"redoAndReveal","Cmd-Up":"goDocStart","Cmd-Down":"goDocEnd","Alt-Left":"goG
roupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStartSmart","Cmd-Right":"
goLineEnd","Alt-Backspace":"delGroupBefore","Alt-Delete":"delGroupAfter","Cmd-/"
:"toggleComment",fallthrough:"devtools-common"};WebInspector.settings.textEditor
Indent.addChangeListener(this._updateEditorIndentation,this);this._updateEditorI
ndentation();WebInspector.settings.showWhitespacesInEditor.addChangeListener(thi
s._updateCodeMirrorMode,this);WebInspector.settings.textEditorBracketMatching.ad
dChangeListener(this._enableBracketMatchingIfNeeded,this);this._enableBracketMat
chingIfNeeded();this._codeMirror.setOption("keyMap",WebInspector.isMac()?"devtoo
ls-mac":"devtools-pc");this._codeMirror.setOption("flattenSpans",false);this._co
deMirror.setOption("maxHighlightLength",WebInspector.CodeMirrorTextEditor.maxHig
hlightLength);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.CodeMirrorTextEd
itor.BlockIndentController(this._codeMirror);this._fixWordMovement=new WebInspec
tor.CodeMirrorTextEditor.FixWordMovement(this._codeMirror);this._autocompleteCon
troller=new WebInspector.CodeMirrorTextEditor.AutocompleteController(this,this._
codeMirror);this._codeMirror.on("change",this._change.bind(this));this._codeMirr
or.on("beforeChange",this._beforeChange.bind(this));this._codeMirror.on("gutterC
lick",this._gutterClick.bind(this));this._codeMirror.on("cursorActivity",this._c
ursorActivity.bind(this));this._codeMirror.on("beforeSelectionChange",this._befo
reSelectionChange.bind(this));this._codeMirror.on("scroll",this._scroll.bind(thi
s));this._codeMirror.on("focus",this._focus.bind(this));this._codeMirror.on("blu
r",this._blur.bind(this));this.element.addEventListener("contextmenu",this._cont
extMenu.bind(this),false);function updateAnticipateJumpFlag(value) |
1165 return"css-number";return null;},overrideModeWithPrefixedTokens:function(modeNam
e,tokenPrefix) | |
1166 {var oldModeName=modeName+"-old";if(CodeMirror.modes[oldModeName]) | |
1167 return;CodeMirror.defineMode(oldModeName,CodeMirror.modes[modeName]);CodeMirror.
defineMode(modeName,modeConstructor);function modeConstructor(config,parserConfi
g) | |
1168 {var innerConfig={};for(var i in parserConfig) | |
1169 innerConfig[i]=parserConfig[i];innerConfig.name=oldModeName;var codeMirrorMode=C
odeMirror.getMode(config,innerConfig);codeMirrorMode.name=modeName;codeMirrorMod
e.token=tokenOverride.bind(null,codeMirrorMode.token);return codeMirrorMode;} | |
1170 function tokenOverride(superToken,stream,state) | |
1171 {var token=superToken(stream,state);return token?tokenPrefix+token:token;}}} | |
1172 WebInspector.CodeMirrorUtils.overrideModeWithPrefixedTokens("css","css-");WebIns
pector.CodeMirrorUtils.overrideModeWithPrefixedTokens("javascript","js-");WebIns
pector.CodeMirrorUtils.overrideModeWithPrefixedTokens("xml","xml-");;WebInspecto
r.CodeMirrorTextEditor=function(url,delegate) | |
1173 {WebInspector.View.call(this);this._delegate=delegate;this._url=url;this.registe
rRequiredCSS("cm/codemirror.css");this.registerRequiredCSS("cm/cmdevtools.css");
this._codeMirror=window.CodeMirror(this.element,{lineNumbers:true,gutters:["Code
Mirror-linenumbers"],matchBrackets:true,smartIndent:false,styleSelectedText:true
,electricChars:false,});this._codeMirror._codeMirrorTextEditor=this;CodeMirror.k
eyMap["devtools-common"]={"Left":"goCharLeft","Right":"goCharRight","Up":"goLine
Up","Down":"goLineDown","End":"goLineEnd","Home":"goLineStartSmart","PageUp":"go
PageUp","PageDown":"goPageDown","Delete":"delCharAfter","Backspace":"delCharBefo
re","Tab":"defaultTab","Shift-Tab":"indentLess","Enter":"smartNewlineAndIndent",
"Ctrl-Space":"autocomplete"};CodeMirror.keyMap["devtools-pc"]={"Ctrl-A":"selectA
ll","Ctrl-Z":"undoAndReveal","Shift-Ctrl-Z":"redoAndReveal","Ctrl-Y":"redo","Ctr
l-Home":"goDocStart","Ctrl-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"g
oDocEnd","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLin
eStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":
"delGroupAfter","Ctrl-/":"toggleComment",fallthrough:"devtools-common"};CodeMirr
or.keyMap["devtools-mac"]={"Cmd-A":"selectAll","Cmd-Z":"undoAndReveal","Shift-Cm
d-Z":"redoAndReveal","Cmd-Up":"goDocStart","Cmd-Down":"goDocEnd","Alt-Left":"goG
roupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStartSmart","Cmd-Right":"
goLineEnd","Alt-Backspace":"delGroupBefore","Alt-Delete":"delGroupAfter","Cmd-/"
:"toggleComment",fallthrough:"devtools-common"};WebInspector.settings.textEditor
Indent.addChangeListener(this._updateEditorIndentation,this);this._updateEditorI
ndentation();WebInspector.settings.showWhitespacesInEditor.addChangeListener(thi
s._updateCodeMirrorMode,this);WebInspector.settings.textEditorBracketMatching.ad
dChangeListener(this._enableBracketMatchingIfNeeded,this);this._enableBracketMat
chingIfNeeded();this._codeMirror.setOption("keyMap",WebInspector.isMac()?"devtoo
ls-mac":"devtools-pc");this._codeMirror.setOption("flattenSpans",false);this._co
deMirror.setOption("maxHighlightLength",WebInspector.CodeMirrorTextEditor.maxHig
hlightLength);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.CodeMirrorTextEd
itor.BlockIndentController(this._codeMirror);this._fixWordMovement=new WebInspec
tor.CodeMirrorTextEditor.FixWordMovement(this._codeMirror);this._autocompleteCon
troller=new WebInspector.CodeMirrorTextEditor.AutocompleteController(this,this._
codeMirror);this._codeMirror.on("change",this._change.bind(this));this._codeMirr
or.on("beforeChange",this._beforeChange.bind(this));this._codeMirror.on("gutterC
lick",this._gutterClick.bind(this));this._codeMirror.on("cursorActivity",this._c
ursorActivity.bind(this));this._codeMirror.on("beforeSelectionChange",this._befo
reSelectionChange.bind(this));this._codeMirror.on("scroll",this._scroll.bind(thi
s));this._codeMirror.on("focus",this._focus.bind(this));this._codeMirror.on("blu
r",this._blur.bind(this));this.element.addEventListener("contextmenu",this._cont
extMenu.bind(this),false);function updateAnticipateJumpFlag(value) | |
1174 {this._isHandlingMouseDownEvent=value;} | 1198 {this._isHandlingMouseDownEvent=value;} |
1175 this.element.addEventListener("mousedown",updateAnticipateJumpFlag.bind(this,tru
e),true);this.element.addEventListener("mousedown",updateAnticipateJumpFlag.bind
(this,false),false);this.element.classList.add("fill");this.element.style.overfl
ow="hidden";this.element.firstChild.classList.add("source-code");this.element.fi
rstChild.classList.add("fill");this._elementToWidget=new Map();this._nestedUpdat
esCounter=0;this.element.addEventListener("focus",this._handleElementFocus.bind(
this),false);this.element.addEventListener("keydown",this._handleKeyDown.bind(th
is),true);this.element.addEventListener("keydown",this._handlePostKeyDown.bind(t
his),false);this.element.tabIndex=0;this._setupSelectionColor();this._setupWhite
spaceHighlight();} | 1199 this.element.addEventListener("mousedown",updateAnticipateJumpFlag.bind(this,tru
e),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.addEventLi
stener("focus",this._handleElementFocus.bind(this),false);this.element.addEventL
istener("keydown",this._handleKeyDown.bind(this),true);this.element.addEventList
ener("keydown",this._handlePostKeyDown.bind(this),false);this.element.tabIndex=0
;this._setupWhitespaceHighlight();} |
1176 WebInspector.CodeMirrorTextEditor.BeforeChangeObject;WebInspector.CodeMirrorText
Editor.ChangeObject;WebInspector.CodeMirrorTextEditor.maxHighlightLength=1000;We
bInspector.CodeMirrorTextEditor.autocompleteCommand=function(codeMirror) | 1200 WebInspector.CodeMirrorTextEditor.BeforeChangeObject;WebInspector.CodeMirrorText
Editor.ChangeObject;WebInspector.CodeMirrorTextEditor.maxHighlightLength=1000;We
bInspector.CodeMirrorTextEditor.autocompleteCommand=function(codeMirror) |
1177 {codeMirror._codeMirrorTextEditor._autocompleteController.autocomplete();} | 1201 {codeMirror._codeMirrorTextEditor._autocompleteController.autocomplete();} |
1178 CodeMirror.commands.autocomplete=WebInspector.CodeMirrorTextEditor.autocompleteC
ommand;CodeMirror.commands.smartNewlineAndIndent=function(codeMirror) | 1202 CodeMirror.commands.autocomplete=WebInspector.CodeMirrorTextEditor.autocompleteC
ommand;CodeMirror.commands.smartNewlineAndIndent=function(codeMirror) |
1179 {codeMirror.operation(innerSmartNewlineAndIndent.bind(this,codeMirror));function
countIndent(line) | 1203 {codeMirror.operation(innerSmartNewlineAndIndent.bind(null,codeMirror));function
countIndent(line) |
1180 {for(var i=0;i<line.length;++i){if(!WebInspector.TextUtils.isSpaceChar(line[i])) | 1204 {for(var i=0;i<line.length;++i){if(!WebInspector.TextUtils.isSpaceChar(line[i])) |
1181 return i;} | 1205 return i;} |
1182 return line.length;} | 1206 return line.length;} |
1183 function innerSmartNewlineAndIndent(codeMirror) | 1207 function innerSmartNewlineAndIndent(codeMirror) |
1184 {var cur=codeMirror.getCursor("start");var line=codeMirror.getLine(cur.line);var
indent=cur.line>0?countIndent(line):0;if(cur.ch<=indent){codeMirror.replaceSele
ction("\n"+line.substring(0,cur.ch),"end","+input");codeMirror.setSelection(new
CodeMirror.Pos(cur.line+1,cur.ch));}else | 1208 {var cur=codeMirror.getCursor("start");var line=codeMirror.getLine(cur.line);var
indent=cur.line>0?countIndent(line):0;if(cur.ch<=indent){codeMirror.replaceSele
ction("\n"+line.substring(0,cur.ch),"end","+input");codeMirror.setSelection(new
CodeMirror.Pos(cur.line+1,cur.ch));}else |
1185 codeMirror.execCommand("newlineAndIndent");}} | 1209 codeMirror.execCommand("newlineAndIndent");}} |
1186 CodeMirror.commands.undoAndReveal=function(codemirror) | 1210 CodeMirror.commands.undoAndReveal=function(codemirror) |
1187 {var scrollInfo=codemirror.getScrollInfo();codemirror.execCommand("undo");var cu
rsor=codemirror.getCursor("start");codemirror._codeMirrorTextEditor._innerReveal
Line(cursor.line,scrollInfo);} | 1211 {var scrollInfo=codemirror.getScrollInfo();codemirror.execCommand("undo");var cu
rsor=codemirror.getCursor("start");codemirror._codeMirrorTextEditor._innerReveal
Line(cursor.line,scrollInfo);codemirror._codeMirrorTextEditor._autocompleteContr
oller.finishAutocomplete();} |
1188 CodeMirror.commands.redoAndReveal=function(codemirror) | 1212 CodeMirror.commands.redoAndReveal=function(codemirror) |
1189 {var scrollInfo=codemirror.getScrollInfo();codemirror.execCommand("redo");var cu
rsor=codemirror.getCursor("start");codemirror._codeMirrorTextEditor._innerReveal
Line(cursor.line,scrollInfo);} | 1213 {var scrollInfo=codemirror.getScrollInfo();codemirror.execCommand("redo");var cu
rsor=codemirror.getCursor("start");codemirror._codeMirrorTextEditor._innerReveal
Line(cursor.line,scrollInfo);codemirror._codeMirrorTextEditor._autocompleteContr
oller.finishAutocomplete();} |
1190 WebInspector.CodeMirrorTextEditor.LongLineModeLineLengthThreshold=2000;WebInspec
tor.CodeMirrorTextEditor.MaximumNumberOfWhitespacesPerSingleSpan=16;WebInspector
.CodeMirrorTextEditor.prototype={_enableBracketMatchingIfNeeded:function() | 1214 WebInspector.CodeMirrorTextEditor.LongLineModeLineLengthThreshold=2000;WebInspec
tor.CodeMirrorTextEditor.MaximumNumberOfWhitespacesPerSingleSpan=16;WebInspector
.CodeMirrorTextEditor.MaxEditableTextSize=1024*1024*10;WebInspector.CodeMirrorTe
xtEditor.prototype={_enableBracketMatchingIfNeeded:function() |
1191 {this._codeMirror.setOption("autoCloseBrackets",WebInspector.settings.textEditor
BracketMatching.get()?{explode:false}:false);},wasShown:function() | 1215 {this._codeMirror.setOption("autoCloseBrackets",WebInspector.settings.textEditor
BracketMatching.get()?{explode:false}:false);},wasShown:function() |
1192 {this._codeMirror.refresh();},_guessIndentationLevel:function() | 1216 {if(this._wasOnceShown) |
| 1217 return;this._wasOnceShown=true;this._codeMirror.refresh();},_guessIndentationLev
el:function() |
1193 {var tabRegex=/^\t+/;var tabLines=0;var indents={};function processLine(lineHand
le) | 1218 {var tabRegex=/^\t+/;var tabLines=0;var indents={};function processLine(lineHand
le) |
1194 {var text=lineHandle.text;if(text.length===0||!WebInspector.TextUtils.isSpaceCha
r(text[0])) | 1219 {var text=lineHandle.text;if(text.length===0||!WebInspector.TextUtils.isSpaceCha
r(text[0])) |
1195 return;if(tabRegex.test(text)){++tabLines;return;} | 1220 return;if(tabRegex.test(text)){++tabLines;return;} |
1196 var i=0;while(i<text.length&&WebInspector.TextUtils.isSpaceChar(text[i])) | 1221 var i=0;while(i<text.length&&WebInspector.TextUtils.isSpaceChar(text[i])) |
1197 ++i;if(i%2!==0) | 1222 ++i;if(i%2!==0) |
1198 return;indents[i]=1+(indents[i]||0);} | 1223 return;indents[i]=1+(indents[i]||0);} |
1199 this._codeMirror.eachLine(processLine);var onePercentFilterThreshold=this.linesC
ount/100;if(tabLines&&tabLines>onePercentFilterThreshold) | 1224 this._codeMirror.eachLine(0,1000,processLine);var onePercentFilterThreshold=this
.linesCount/100;if(tabLines&&tabLines>onePercentFilterThreshold) |
1200 return"\t";var minimumIndent=Infinity;for(var i in indents){if(indents[i]<onePer
centFilterThreshold) | 1225 return"\t";var minimumIndent=Infinity;for(var i in indents){if(indents[i]<onePer
centFilterThreshold) |
1201 continue;var indent=parseInt(i,10);if(minimumIndent>indent) | 1226 continue;var indent=parseInt(i,10);if(minimumIndent>indent) |
1202 minimumIndent=indent;} | 1227 minimumIndent=indent;} |
1203 if(minimumIndent===Infinity) | 1228 if(minimumIndent===Infinity) |
1204 return WebInspector.TextUtils.Indent.FourSpaces;return new Array(minimumIndent+1
).join(" ");},_updateEditorIndentation:function() | 1229 return WebInspector.TextUtils.Indent.FourSpaces;return new Array(minimumIndent+1
).join(" ");},_updateEditorIndentation:function() |
1205 {var extraKeys={};var indent=WebInspector.settings.textEditorIndent.get();if(Web
Inspector.settings.textEditorAutoDetectIndent.get()) | 1230 {var extraKeys={};var indent=WebInspector.settings.textEditorIndent.get();if(Web
Inspector.settings.textEditorAutoDetectIndent.get()) |
1206 indent=this._guessIndentationLevel();if(indent===WebInspector.TextUtils.Indent.T
abCharacter){this._codeMirror.setOption("indentWithTabs",true);this._codeMirror.
setOption("indentUnit",4);}else{this._codeMirror.setOption("indentWithTabs",fals
e);this._codeMirror.setOption("indentUnit",indent.length);extraKeys.Tab=function
(codeMirror) | 1231 indent=this._guessIndentationLevel();if(indent===WebInspector.TextUtils.Indent.T
abCharacter){this._codeMirror.setOption("indentWithTabs",true);this._codeMirror.
setOption("indentUnit",4);}else{this._codeMirror.setOption("indentWithTabs",fals
e);this._codeMirror.setOption("indentUnit",indent.length);extraKeys.Tab=function
(codeMirror) |
1207 {if(codeMirror.somethingSelected()) | 1232 {if(codeMirror.somethingSelected()) |
1208 return CodeMirror.Pass;var pos=codeMirror.getCursor("head");codeMirror.replaceRa
nge(indent.substring(pos.ch%indent.length),codeMirror.getCursor());}} | 1233 return CodeMirror.Pass;var pos=codeMirror.getCursor("head");codeMirror.replaceRa
nge(indent.substring(pos.ch%indent.length),codeMirror.getCursor());}} |
1209 this._codeMirror.setOption("extraKeys",extraKeys);this._indentationLevel=indent;
},indent:function() | 1234 this._codeMirror.setOption("extraKeys",extraKeys);this._indentationLevel=indent;
},indent:function() |
1210 {return this._indentationLevel;},highlightSearchResults:function(regex,range) | 1235 {return this._indentationLevel;},highlightSearchResults:function(regex,range) |
1211 {function innerHighlightRegex() | 1236 {function innerHighlightRegex() |
1212 {if(range){this.revealLine(range.startLine);if(range.endColumn>WebInspector.Code
MirrorTextEditor.maxHighlightLength) | 1237 {if(range){this._revealLine(range.startLine);if(range.endColumn>WebInspector.Cod
eMirrorTextEditor.maxHighlightLength) |
1213 this.setSelection(range);else | 1238 this.setSelection(range);else |
1214 this.setSelection(WebInspector.TextRange.createFromLocation(range.startLine,rang
e.startColumn));}else{this.setSelection(this.selection().collapseToEnd());} | 1239 this.setSelection(WebInspector.TextRange.createFromLocation(range.startLine,rang
e.startColumn));}else{this.setSelection(this.selection().collapseToEnd());} |
1215 this._tokenHighlighter.highlightSearchResults(regex,range);} | 1240 this._tokenHighlighter.highlightSearchResults(regex,range);} |
1216 if(!this._selectionBeforeSearch) | 1241 if(!this._selectionBeforeSearch) |
1217 this._selectionBeforeSearch=this.selection();this._codeMirror.operation(innerHig
hlightRegex.bind(this));},cancelSearchResultsHighlight:function() | 1242 this._selectionBeforeSearch=this.selection();this._codeMirror.operation(innerHig
hlightRegex.bind(this));},cancelSearchResultsHighlight:function() |
1218 {this._codeMirror.operation(this._tokenHighlighter.highlightSelectedTokens.bind(
this._tokenHighlighter));if(this._selectionBeforeSearch){this._reportJump(this._
selectionBeforeSearch,this.selection());delete this._selectionBeforeSearch;}},un
do:function() | 1243 {this._codeMirror.operation(this._tokenHighlighter.highlightSelectedTokens.bind(
this._tokenHighlighter));if(this._selectionBeforeSearch){this._reportJump(this._
selectionBeforeSearch,this.selection());delete this._selectionBeforeSearch;}},un
do:function() |
1219 {this._codeMirror.undo();},redo:function() | 1244 {this._codeMirror.undo();},redo:function() |
1220 {this._codeMirror.redo();},_setupSelectionColor:function() | 1245 {this._codeMirror.redo();},_setupWhitespaceHighlight:function() |
1221 {if(WebInspector.CodeMirrorTextEditor._selectionStyleInjected) | |
1222 return;WebInspector.CodeMirrorTextEditor._selectionStyleInjected=true;var backgr
oundColor=WebInspector.getSelectionBackgroundColor();var backgroundColorRule=bac
kgroundColor?".CodeMirror .CodeMirror-selected { background-color: "+backgroundC
olor+";}":"";var foregroundColor=WebInspector.getSelectionForegroundColor();var
foregroundColorRule=foregroundColor?".CodeMirror .CodeMirror-selectedtext:not(.C
odeMirror-persist-highlight) { color: "+foregroundColor+"!important;}":"";if(!fo
regroundColorRule&&!backgroundColorRule) | |
1223 return;var style=document.createElement("style");style.textContent=backgroundCol
orRule+foregroundColorRule;document.head.appendChild(style);},_setupWhitespaceHi
ghlight:function() | |
1224 {if(WebInspector.CodeMirrorTextEditor._whitespaceStyleInjected||!WebInspector.se
ttings.showWhitespacesInEditor.get()) | 1246 {if(WebInspector.CodeMirrorTextEditor._whitespaceStyleInjected||!WebInspector.se
ttings.showWhitespacesInEditor.get()) |
1225 return;WebInspector.CodeMirrorTextEditor._whitespaceStyleInjected=true;const cla
ssBase=".show-whitespaces .CodeMirror .cm-whitespace-";const spaceChar="·";var s
paceChars="";var rules="";for(var i=1;i<=WebInspector.CodeMirrorTextEditor.Maxim
umNumberOfWhitespacesPerSingleSpan;++i){spaceChars+=spaceChar;var rule=classBase
+i+"::before { content: '"+spaceChars+"';}\n";rules+=rule;} | 1247 return;WebInspector.CodeMirrorTextEditor._whitespaceStyleInjected=true;const cla
ssBase=".show-whitespaces .CodeMirror .cm-whitespace-";const spaceChar="·";var s
paceChars="";var rules="";for(var i=1;i<=WebInspector.CodeMirrorTextEditor.Maxim
umNumberOfWhitespacesPerSingleSpan;++i){spaceChars+=spaceChar;var rule=classBase
+i+"::before { content: '"+spaceChars+"';}\n";rules+=rule;} |
1226 var style=document.createElement("style");style.textContent=rules;document.head.
appendChild(style);},_handleKeyDown:function(e) | 1248 var style=document.createElement("style");style.textContent=rules;document.head.
appendChild(style);},_handleKeyDown:function(e) |
1227 {if(this._autocompleteController.keyDown(e)) | 1249 {if(this._autocompleteController.keyDown(e)) |
1228 e.consume(true);},_handlePostKeyDown:function(e) | 1250 e.consume(true);},_handlePostKeyDown:function(e) |
1229 {if(e.defaultPrevented) | 1251 {if(e.defaultPrevented) |
1230 e.consume(true);},_shouldProcessWordForAutocompletion:function(word) | 1252 e.consume(true);},_shouldProcessWordForAutocompletion:function(word) |
1231 {return word.length&&(word[0]<'0'||word[0]>'9');},_addTextToCompletionDictionary
:function(text) | 1253 {return word.length&&(word[0]<'0'||word[0]>'9');},_addTextToCompletionDictionary
:function(text) |
1232 {var words=WebInspector.TextUtils.textToWords(text);for(var i=0;i<words.length;+
+i){if(this._shouldProcessWordForAutocompletion(words[i])) | 1254 {if(this.readOnly()) |
| 1255 return;var words=WebInspector.TextUtils.textToWords(text);for(var i=0;i<words.le
ngth;++i){if(this._shouldProcessWordForAutocompletion(words[i])) |
1233 this._dictionary.addWord(words[i]);}},_removeTextFromCompletionDictionary:functi
on(text) | 1256 this._dictionary.addWord(words[i]);}},_removeTextFromCompletionDictionary:functi
on(text) |
1234 {var words=WebInspector.TextUtils.textToWords(text);for(var i=0;i<words.length;+
+i){if(this._shouldProcessWordForAutocompletion(words[i])) | 1257 {if(this.readOnly()) |
| 1258 return;var words=WebInspector.TextUtils.textToWords(text);for(var i=0;i<words.le
ngth;++i){if(this._shouldProcessWordForAutocompletion(words[i])) |
1235 this._dictionary.removeWord(words[i]);}},setCompletionDictionary:function(dictio
nary) | 1259 this._dictionary.removeWord(words[i]);}},setCompletionDictionary:function(dictio
nary) |
1236 {if(!dictionary){delete this._dictionary;return;} | 1260 {if(!dictionary){delete this._dictionary;return;} |
1237 this._dictionary=dictionary;this._addTextToCompletionDictionary(this.text());},c
ursorPositionToCoordinates:function(lineNumber,column) | 1261 this._dictionary=dictionary;this._addTextToCompletionDictionary(this.text());},c
ursorPositionToCoordinates:function(lineNumber,column) |
1238 {if(lineNumber>=this._codeMirror.lineCount()||lineNumber<0||column<0||column>thi
s._codeMirror.getLine(lineNumber).length) | 1262 {if(lineNumber>=this._codeMirror.lineCount()||lineNumber<0||column<0||column>thi
s._codeMirror.getLine(lineNumber).length) |
1239 return null;var metrics=this._codeMirror.cursorCoords(new CodeMirror.Pos(lineNum
ber,column));return{x:metrics.left,y:metrics.top,height:metrics.bottom-metrics.t
op};},coordinatesToCursorPosition:function(x,y) | 1263 return null;var metrics=this._codeMirror.cursorCoords(new CodeMirror.Pos(lineNum
ber,column));return{x:metrics.left,y:metrics.top,height:metrics.bottom-metrics.t
op};},coordinatesToCursorPosition:function(x,y) |
1240 {var element=document.elementFromPoint(x,y);if(!element||!element.isSelfOrDescen
dant(this._codeMirror.getWrapperElement())) | 1264 {var element=document.elementFromPoint(x,y);if(!element||!element.isSelfOrDescen
dant(this._codeMirror.getWrapperElement())) |
1241 return null;var gutterBox=this._codeMirror.getGutterElement().boxInWindow();if(x
>=gutterBox.x&&x<=gutterBox.x+gutterBox.width&&y>=gutterBox.y&&y<=gutterBox.y+gu
tterBox.height) | 1265 return null;var gutterBox=this._codeMirror.getGutterElement().boxInWindow();if(x
>=gutterBox.x&&x<=gutterBox.x+gutterBox.width&&y>=gutterBox.y&&y<=gutterBox.y+gu
tterBox.height) |
1242 return null;var coords=this._codeMirror.coordsChar({left:x,top:y});return this._
toRange(coords,coords);},tokenAtTextPosition:function(lineNumber,column) | 1266 return null;var coords=this._codeMirror.coordsChar({left:x,top:y});return this._
toRange(coords,coords);},tokenAtTextPosition:function(lineNumber,column) |
1243 {if(lineNumber<0||lineNumber>=this._codeMirror.lineCount()) | 1267 {if(lineNumber<0||lineNumber>=this._codeMirror.lineCount()) |
1244 return null;var token=this._codeMirror.getTokenAt(new CodeMirror.Pos(lineNumber,
(column||0)+1));if(!token||!token.type) | 1268 return null;var token=this._codeMirror.getTokenAt(new CodeMirror.Pos(lineNumber,
(column||0)+1));if(!token||!token.type) |
1245 return null;var convertedType=WebInspector.CodeMirrorUtils.convertTokenType(toke
n.type);if(!convertedType) | 1269 return null;return{startColumn:token.start,endColumn:token.end-1,type:token.type
};},copyRange:function(textRange) |
1246 return null;return{startColumn:token.start,endColumn:token.end-1,type:convertedT
ype};},copyRange:function(textRange) | |
1247 {var pos=this._toPos(textRange.normalize());return this._codeMirror.getRange(pos
.start,pos.end);},isClean:function() | 1270 {var pos=this._toPos(textRange.normalize());return this._codeMirror.getRange(pos
.start,pos.end);},isClean:function() |
1248 {return this._codeMirror.isClean();},markClean:function() | 1271 {return this._codeMirror.isClean();},markClean:function() |
1249 {this._codeMirror.markClean();},_hasLongLines:function() | 1272 {this._codeMirror.markClean();},_hasLongLines:function() |
1250 {function lineIterator(lineHandle) | 1273 {function lineIterator(lineHandle) |
1251 {if(lineHandle.text.length>WebInspector.CodeMirrorTextEditor.LongLineModeLineLen
gthThreshold) | 1274 {if(lineHandle.text.length>WebInspector.CodeMirrorTextEditor.LongLineModeLineLen
gthThreshold) |
1252 hasLongLines=true;return hasLongLines;} | 1275 hasLongLines=true;return hasLongLines;} |
1253 var hasLongLines=false;this._codeMirror.eachLine(lineIterator);return hasLongLin
es;},_whitespaceOverlayMode:function(mimeType) | 1276 var hasLongLines=false;this._codeMirror.eachLine(lineIterator);return hasLongLin
es;},_whitespaceOverlayMode:function(mimeType) |
1254 {var modeName=CodeMirror.mimeModes[mimeType]?(CodeMirror.mimeModes[mimeType].nam
e||CodeMirror.mimeModes[mimeType]):CodeMirror.mimeModes["text/plain"];modeName+=
"+whitespaces";if(CodeMirror.modes[modeName]) | 1277 {var modeName=CodeMirror.mimeModes[mimeType]?(CodeMirror.mimeModes[mimeType].nam
e||CodeMirror.mimeModes[mimeType]):CodeMirror.mimeModes["text/plain"];modeName+=
"+whitespaces";if(CodeMirror.modes[modeName]) |
1255 return modeName;function modeConstructor(config,parserConfig) | 1278 return modeName;function modeConstructor(config,parserConfig) |
1256 {function nextToken(stream) | 1279 {function nextToken(stream) |
1257 {if(stream.peek()===" "){var spaces=0;while(spaces<WebInspector.CodeMirrorTextEd
itor.MaximumNumberOfWhitespacesPerSingleSpan&&stream.peek()===" "){++spaces;stre
am.next();} | 1280 {if(stream.peek()===" "){var spaces=0;while(spaces<WebInspector.CodeMirrorTextEd
itor.MaximumNumberOfWhitespacesPerSingleSpan&&stream.peek()===" "){++spaces;stre
am.next();} |
1258 return"whitespace whitespace-"+spaces;} | 1281 return"whitespace whitespace-"+spaces;} |
1259 while(!stream.eol()&&stream.peek()!==" ") | 1282 while(!stream.eol()&&stream.peek()!==" ") |
1260 stream.next();return null;} | 1283 stream.next();return null;} |
1261 var whitespaceMode={token:nextToken};return CodeMirror.overlayMode(CodeMirror.ge
tMode(config,mimeType),whitespaceMode,false);} | 1284 var whitespaceMode={token:nextToken};return CodeMirror.overlayMode(CodeMirror.ge
tMode(config,mimeType),whitespaceMode,false);} |
1262 CodeMirror.defineMode(modeName,modeConstructor);return modeName;},_enableLongLin
esMode:function() | 1285 CodeMirror.defineMode(modeName,modeConstructor);return modeName;},_enableLongLin
esMode:function() |
1263 {this._codeMirror.setOption("styleSelectedText",false);this._longLinesMode=true;
},_disableLongLinesMode:function() | 1286 {this._codeMirror.setOption("styleSelectedText",false);this._longLinesMode=true;
},_disableLongLinesMode:function() |
1264 {this._codeMirror.setOption("styleSelectedText",true);this._longLinesMode=false;
},_updateCodeMirrorMode:function() | 1287 {this._codeMirror.setOption("styleSelectedText",true);this._longLinesMode=false;
},_updateCodeMirrorMode:function() |
1265 {var showWhitespaces=WebInspector.settings.showWhitespacesInEditor.get();this.el
ement.enableStyleClass("show-whitespaces",showWhitespaces);this._codeMirror.setO
ption("mode",showWhitespaces?this._whitespaceOverlayMode(this._mimeType):this._m
imeType);},setMimeType:function(mimeType) | 1288 {var showWhitespaces=WebInspector.settings.showWhitespacesInEditor.get();this.el
ement.classList.toggle("show-whitespaces",showWhitespaces);this._codeMirror.setO
ption("mode",showWhitespaces?this._whitespaceOverlayMode(this._mimeType):this._m
imeType);},setMimeType:function(mimeType) |
1266 {this._mimeType=mimeType;if(this._hasLongLines()) | 1289 {this._mimeType=mimeType;if(this._hasLongLines()) |
1267 this._enableLongLinesMode();else | 1290 this._enableLongLinesMode();else |
1268 this._disableLongLinesMode();this._updateCodeMirrorMode();},setReadOnly:function
(readOnly) | 1291 this._disableLongLinesMode();this._updateCodeMirrorMode();},setReadOnly:function
(readOnly) |
1269 {this.element.enableStyleClass("CodeMirror-readonly",readOnly) | 1292 {this.element.classList.toggle("CodeMirror-readonly",readOnly) |
1270 this._codeMirror.setOption("readOnly",readOnly);},readOnly:function() | 1293 this._codeMirror.setOption("readOnly",readOnly);},readOnly:function() |
1271 {return!!this._codeMirror.getOption("readOnly");},removeHighlight:function(highl
ightDescriptor) | 1294 {return!!this._codeMirror.getOption("readOnly");},removeHighlight:function(highl
ightDescriptor) |
1272 {highlightDescriptor.clear();},highlightRange:function(range,cssClass) | 1295 {highlightDescriptor.clear();},highlightRange:function(range,cssClass) |
1273 {cssClass="CodeMirror-persist-highlight "+cssClass;var pos=this._toPos(range);++
pos.end.ch;return this._codeMirror.markText(pos.start,pos.end,{className:cssClas
s,startStyle:cssClass+"-start",endStyle:cssClass+"-end"});},defaultFocusedElemen
t:function() | 1296 {cssClass="CodeMirror-persist-highlight "+cssClass;var pos=this._toPos(range);++
pos.end.ch;return this._codeMirror.markText(pos.start,pos.end,{className:cssClas
s,startStyle:cssClass+"-start",endStyle:cssClass+"-end"});},defaultFocusedElemen
t:function() |
1274 {return this.element;},focus:function() | 1297 {return this.element;},focus:function() |
1275 {this._codeMirror.focus();},_handleElementFocus:function() | 1298 {this._codeMirror.focus();},_handleElementFocus:function() |
1276 {this._codeMirror.focus();},beginUpdates:function() | 1299 {this._codeMirror.focus();},beginUpdates:function() |
1277 {++this._nestedUpdatesCounter;},endUpdates:function() | 1300 {++this._nestedUpdatesCounter;},endUpdates:function() |
1278 {if(!--this._nestedUpdatesCounter) | 1301 {if(!--this._nestedUpdatesCounter) |
1279 this._codeMirror.refresh();},revealLine:function(lineNumber) | 1302 this._codeMirror.refresh();},_revealLine:function(lineNumber) |
1280 {this._innerRevealLine(lineNumber,this._codeMirror.getScrollInfo());},_innerReve
alLine:function(lineNumber,scrollInfo) | 1303 {this._innerRevealLine(lineNumber,this._codeMirror.getScrollInfo());},_innerReve
alLine:function(lineNumber,scrollInfo) |
1281 {var topLine=this._codeMirror.lineAtHeight(scrollInfo.top,"local");var bottomLin
e=this._codeMirror.lineAtHeight(scrollInfo.top+scrollInfo.clientHeight,"local");
var linesPerScreen=bottomLine-topLine+1;if(lineNumber<topLine){var topLineToReve
al=Math.max(lineNumber-(linesPerScreen/2)+1,0)|0;this._codeMirror.scrollIntoView
(new CodeMirror.Pos(topLineToReveal,0));}else if(lineNumber>bottomLine){var bott
omLineToReveal=Math.min(lineNumber+(linesPerScreen/2)-1,this.linesCount-1)|0;thi
s._codeMirror.scrollIntoView(new CodeMirror.Pos(bottomLineToReveal,0));}},_gutte
rClick:function(instance,lineNumber,gutter,event) | 1304 {var topLine=this._codeMirror.lineAtHeight(scrollInfo.top,"local");var bottomLin
e=this._codeMirror.lineAtHeight(scrollInfo.top+scrollInfo.clientHeight,"local");
var linesPerScreen=bottomLine-topLine+1;if(lineNumber<topLine){var topLineToReve
al=Math.max(lineNumber-(linesPerScreen/2)+1,0)|0;this._codeMirror.scrollIntoView
(new CodeMirror.Pos(topLineToReveal,0));}else if(lineNumber>bottomLine){var bott
omLineToReveal=Math.min(lineNumber+(linesPerScreen/2)-1,this.linesCount-1)|0;thi
s._codeMirror.scrollIntoView(new CodeMirror.Pos(bottomLineToReveal,0));}},_gutte
rClick:function(instance,lineNumber,gutter,event) |
1282 {this.dispatchEventToListeners(WebInspector.TextEditor.Events.GutterClick,{lineN
umber:lineNumber,event:event});},_contextMenu:function(event) | 1305 {this.dispatchEventToListeners(WebInspector.TextEditor.Events.GutterClick,{lineN
umber:lineNumber,event:event});},_contextMenu:function(event) |
1283 {var contextMenu=new WebInspector.ContextMenu(event);var target=event.target.enc
losingNodeOrSelfWithClass("CodeMirror-gutter-elt");if(target) | 1306 {var contextMenu=new WebInspector.ContextMenu(event);var target=event.target.enc
losingNodeOrSelfWithClass("CodeMirror-gutter-elt");if(target) |
1284 this._delegate.populateLineGutterContextMenu(contextMenu,parseInt(target.textCon
tent,10)-1);else | 1307 this._delegate.populateLineGutterContextMenu(contextMenu,parseInt(target.textCon
tent,10)-1);else |
1285 this._delegate.populateTextAreaContextMenu(contextMenu,0);contextMenu.show();},a
ddBreakpoint:function(lineNumber,disabled,conditional) | 1308 this._delegate.populateTextAreaContextMenu(contextMenu,0);contextMenu.show();},a
ddBreakpoint:function(lineNumber,disabled,conditional) |
1286 {if(lineNumber<0||lineNumber>=this._codeMirror.lineCount()) | 1309 {if(lineNumber<0||lineNumber>=this._codeMirror.lineCount()) |
1287 return;var className="cm-breakpoint"+(conditional?" cm-breakpoint-conditional":"
")+(disabled?" cm-breakpoint-disabled":"");this._codeMirror.addLineClass(lineNum
ber,"wrap",className);},removeBreakpoint:function(lineNumber) | 1310 return;var className="cm-breakpoint"+(conditional?" cm-breakpoint-conditional":"
")+(disabled?" cm-breakpoint-disabled":"");this._codeMirror.addLineClass(lineNum
ber,"wrap",className);},removeBreakpoint:function(lineNumber) |
1288 {if(lineNumber<0||lineNumber>=this._codeMirror.lineCount()) | 1311 {if(lineNumber<0||lineNumber>=this._codeMirror.lineCount()) |
1289 return;var wrapClasses=this._codeMirror.getLineHandle(lineNumber).wrapClass;if(!
wrapClasses) | 1312 return;var wrapClasses=this._codeMirror.getLineHandle(lineNumber).wrapClass;if(!
wrapClasses) |
1290 return;var classes=wrapClasses.split(" ");for(var i=0;i<classes.length;++i){if(c
lasses[i].startsWith("cm-breakpoint")) | 1313 return;var classes=wrapClasses.split(" ");for(var i=0;i<classes.length;++i){if(c
lasses[i].startsWith("cm-breakpoint")) |
1291 this._codeMirror.removeLineClass(lineNumber,"wrap",classes[i]);}},setExecutionLi
ne:function(lineNumber) | 1314 this._codeMirror.removeLineClass(lineNumber,"wrap",classes[i]);}},setExecutionLi
ne:function(lineNumber) |
1292 {this._executionLine=this._codeMirror.getLineHandle(lineNumber);this._codeMirror
.addLineClass(this._executionLine,"wrap","cm-execution-line");},clearExecutionLi
ne:function() | 1315 {this.clearPositionHighlight();this._executionLine=this._codeMirror.getLineHandl
e(lineNumber);if(!this._executionLine) |
1293 {if(this._executionLine) | 1316 return;this._codeMirror.addLineClass(this._executionLine,"wrap","cm-execution-li
ne");},clearExecutionLine:function() |
| 1317 {this.clearPositionHighlight();if(this._executionLine) |
1294 this._codeMirror.removeLineClass(this._executionLine,"wrap","cm-execution-line")
;delete this._executionLine;},addDecoration:function(lineNumber,element) | 1318 this._codeMirror.removeLineClass(this._executionLine,"wrap","cm-execution-line")
;delete this._executionLine;},addDecoration:function(lineNumber,element) |
1295 {var widget=this._codeMirror.addLineWidget(lineNumber,element);this._elementToWi
dget.put(element,widget);},removeDecoration:function(lineNumber,element) | 1319 {var widget=this._codeMirror.addLineWidget(lineNumber,element);this._elementToWi
dget.put(element,widget);},removeDecoration:function(lineNumber,element) |
1296 {var widget=this._elementToWidget.remove(element);if(widget) | 1320 {var widget=this._elementToWidget.remove(element);if(widget) |
1297 this._codeMirror.removeLineWidget(widget);},highlightPosition:function(lineNumbe
r,columnNumber) | 1321 this._codeMirror.removeLineWidget(widget);},revealPosition:function(lineNumber,c
olumnNumber,shouldHighlight) |
1298 {if(lineNumber<0) | 1322 {lineNumber=Number.constrain(lineNumber,0,this._codeMirror.lineCount()-1);if(typ
eof columnNumber!=="number") |
1299 return;lineNumber=Math.min(lineNumber,this._codeMirror.lineCount()-1);if(typeof
columnNumber!=="number"||columnNumber<0||columnNumber>this._codeMirror.getLine(l
ineNumber).length) | 1323 columnNumber=0;columnNumber=Number.constrain(columnNumber,0,this._codeMirror.get
Line(lineNumber).length);this.clearPositionHighlight();this._highlightedLine=thi
s._codeMirror.getLineHandle(lineNumber);if(!this._highlightedLine) |
1300 columnNumber=0;this.clearPositionHighlight();this._highlightedLine=this._codeMir
ror.getLineHandle(lineNumber);if(!this._highlightedLine) | 1324 return;this._revealLine(lineNumber);if(shouldHighlight){this._codeMirror.addLine
Class(this._highlightedLine,null,"cm-highlight");this._clearHighlightTimeout=set
Timeout(this.clearPositionHighlight.bind(this),2000);} |
1301 return;this.revealLine(lineNumber);this._codeMirror.addLineClass(this._highlight
edLine,null,"cm-highlight");this._clearHighlightTimeout=setTimeout(this.clearPos
itionHighlight.bind(this),2000);if(!this.readOnly()) | |
1302 this.setSelection(WebInspector.TextRange.createFromLocation(lineNumber,columnNum
ber));},clearPositionHighlight:function() | 1325 this.setSelection(WebInspector.TextRange.createFromLocation(lineNumber,columnNum
ber));},clearPositionHighlight:function() |
1303 {if(this._clearHighlightTimeout) | 1326 {if(this._clearHighlightTimeout) |
1304 clearTimeout(this._clearHighlightTimeout);delete this._clearHighlightTimeout;if(
this._highlightedLine) | 1327 clearTimeout(this._clearHighlightTimeout);delete this._clearHighlightTimeout;if(
this._highlightedLine) |
1305 this._codeMirror.removeLineClass(this._highlightedLine,null,"cm-highlight");dele
te this._highlightedLine;},elementsToRestoreScrollPositionsFor:function() | 1328 this._codeMirror.removeLineClass(this._highlightedLine,null,"cm-highlight");dele
te this._highlightedLine;},elementsToRestoreScrollPositionsFor:function() |
1306 {return[];},inheritScrollPositions:function(textEditor) | 1329 {return[];},inheritScrollPositions:function(textEditor) |
1307 {},_updatePaddingBottom:function(width,height) | 1330 {},_updatePaddingBottom:function(width,height) |
1308 {var scrollInfo=this._codeMirror.getScrollInfo();var newPaddingBottom;var linesE
lement=this.element.firstElementChild.querySelector(".CodeMirror-lines");var lin
eCount=this._codeMirror.lineCount();if(lineCount<=1) | 1331 {var scrollInfo=this._codeMirror.getScrollInfo();var newPaddingBottom;var linesE
lement=this.element.firstElementChild.querySelector(".CodeMirror-lines");var lin
eCount=this._codeMirror.lineCount();if(lineCount<=1) |
1309 newPaddingBottom=0;else | 1332 newPaddingBottom=0;else |
1310 newPaddingBottom=Math.max(scrollInfo.clientHeight-this._codeMirror.getLineHandle
(this._codeMirror.lastLine()).height,0);newPaddingBottom+="px";linesElement.styl
e.paddingBottom=newPaddingBottom;this._codeMirror.setSize(width,height);},_resiz
eEditor:function() | 1333 newPaddingBottom=Math.max(scrollInfo.clientHeight-this._codeMirror.getLineHandle
(this._codeMirror.lastLine()).height,0);newPaddingBottom+="px";linesElement.styl
e.paddingBottom=newPaddingBottom;this._codeMirror.setSize(width,height);},_resiz
eEditor:function() |
1311 {var parentElement=this.element.parentElement;if(!parentElement||!this.isShowing
()) | 1334 {var parentElement=this.element.parentElement;if(!parentElement||!this.isShowing
()) |
1312 return;var scrollInfo=this._codeMirror.getScrollInfo();var width=parentElement.o
ffsetWidth;var height=parentElement.offsetHeight;this._codeMirror.setSize(width,
height);this._updatePaddingBottom(width,height);this._codeMirror.scrollTo(scroll
Info.left,scrollInfo.top);},onResize:function() | 1335 return;var scrollLeft=this._codeMirror.doc.scrollLeft;var scrollTop=this._codeMi
rror.doc.scrollTop;var width=parentElement.offsetWidth;var height=parentElement.
offsetHeight;this._codeMirror.setSize(width,height);this._updatePaddingBottom(wi
dth,height);this._codeMirror.scrollTo(scrollLeft,scrollTop);},onResize:function(
) |
1313 {this._resizeEditor();},editRange:function(range,text) | 1336 {this._autocompleteController.finishAutocomplete();this._resizeEditor();},editRa
nge:function(range,text) |
1314 {var pos=this._toPos(range);this._codeMirror.replaceRange(text,pos.start,pos.end
);var newRange=this._toRange(pos.start,this._codeMirror.posFromIndex(this._codeM
irror.indexFromPos(pos.start)+text.length));this._delegate.onTextChanged(range,n
ewRange);if(WebInspector.settings.textEditorAutoDetectIndent.get()) | 1337 {var pos=this._toPos(range);this._codeMirror.replaceRange(text,pos.start,pos.end
);var newRange=this._toRange(pos.start,this._codeMirror.posFromIndex(this._codeM
irror.indexFromPos(pos.start)+text.length));this._delegate.onTextChanged(range,n
ewRange);if(WebInspector.settings.textEditorAutoDetectIndent.get()) |
1315 this._updateEditorIndentation();return newRange;},_wordRangeForCursorPosition:fu
nction(lineNumber,column,prefixOnly) | 1338 this._updateEditorIndentation();return newRange;},_wordRangeForCursorPosition:fu
nction(lineNumber,column,prefixOnly) |
1316 {var line=this.line(lineNumber);if(column===0||!WebInspector.TextUtils.isWordCha
r(line.charAt(column-1))) | 1339 {var line=this.line(lineNumber);if(column===0||!WebInspector.TextUtils.isWordCha
r(line.charAt(column-1))) |
1317 return null;var wordStart=column-1;while(wordStart>0&&WebInspector.TextUtils.isW
ordChar(line.charAt(wordStart-1))) | 1340 return null;var wordStart=column-1;while(wordStart>0&&WebInspector.TextUtils.isW
ordChar(line.charAt(wordStart-1))) |
1318 --wordStart;if(prefixOnly) | 1341 --wordStart;if(prefixOnly) |
1319 return new WebInspector.TextRange(lineNumber,wordStart,lineNumber,column);var wo
rdEnd=column;while(wordEnd<line.length&&WebInspector.TextUtils.isWordChar(line.c
harAt(wordEnd))) | 1342 return new WebInspector.TextRange(lineNumber,wordStart,lineNumber,column);var wo
rdEnd=column;while(wordEnd<line.length&&WebInspector.TextUtils.isWordChar(line.c
harAt(wordEnd))) |
1320 ++wordEnd;return new WebInspector.TextRange(lineNumber,wordStart,lineNumber,word
End);},_beforeChange:function(codeMirror,changeObject) | 1343 ++wordEnd;return new WebInspector.TextRange(lineNumber,wordStart,lineNumber,word
End);},_beforeChange:function(codeMirror,changeObject) |
1321 {if(!this._dictionary) | 1344 {if(!this._dictionary) |
1322 return;this._updatedLines=this._updatedLines||{};for(var i=changeObject.from.lin
e;i<=changeObject.to.line;++i) | 1345 return;this._updatedLines=this._updatedLines||{};for(var i=changeObject.from.lin
e;i<=changeObject.to.line;++i) |
1323 this._updatedLines[i]=this.line(i);},_change:function(codeMirror,changeObject) | 1346 this._updatedLines[i]=this.line(i);},_change:function(codeMirror,changeObject) |
1324 {var hasOneLine=this._codeMirror.lineCount()===1;if(hasOneLine!==this._hasOneLin
e) | 1347 {var hasOneLine=this._codeMirror.lineCount()===1;if(hasOneLine!==this._hasOneLin
e) |
1325 this._resizeEditor();this._hasOneLine=hasOneLine;var widgets=this._elementToWidg
et.values();for(var i=0;i<widgets.length;++i) | 1348 this._resizeEditor();this._hasOneLine=hasOneLine;var widgets=this._elementToWidg
et.values();for(var i=0;i<widgets.length;++i) |
1326 this._codeMirror.removeLineWidget(widgets[i]);this._elementToWidget.clear();if(t
his._updatedLines){for(var lineNumber in this._updatedLines) | 1349 this._codeMirror.removeLineWidget(widgets[i]);this._elementToWidget.clear();if(t
his._updatedLines){for(var lineNumber in this._updatedLines) |
1327 this._removeTextFromCompletionDictionary(this._updatedLines[lineNumber]);delete
this._updatedLines;} | 1350 this._removeTextFromCompletionDictionary(this._updatedLines[lineNumber]);delete
this._updatedLines;} |
1328 var linesToUpdate={};var singleCharInput=false;do{var oldRange=this._toRange(cha
ngeObject.from,changeObject.to);var newRange=oldRange.clone();var linesAdded=cha
ngeObject.text.length;singleCharInput=(changeObject.origin==="+input"&&changeObj
ect.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;newRan
ge.endColumn=newRange.startColumn+changeObject.text[0].length;}else{newRange.end
Line=newRange.startLine+linesAdded-1;newRange.endColumn=changeObject.text[linesA
dded-1].length;} | 1351 var linesToUpdate={};var singleCharInput=false;do{var oldRange=this._toRange(cha
ngeObject.from,changeObject.to);var newRange=oldRange.clone();var linesAdded=cha
ngeObject.text.length;singleCharInput=(changeObject.origin==="+input"&&changeObj
ect.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;newRan
ge.endColumn=newRange.startColumn+changeObject.text[0].length;}else{newRange.end
Line=newRange.startLine+linesAdded-1;newRange.endColumn=changeObject.text[linesA
dded-1].length;} |
1329 if(!this._muteTextChangedEvent) | 1352 if(!this._muteTextChangedEvent) |
1330 this._delegate.onTextChanged(oldRange,newRange);for(var i=newRange.startLine;i<=
newRange.endLine;++i){linesToUpdate[i]=true;} | 1353 this._delegate.onTextChanged(oldRange,newRange);if(this._dictionary){for(var i=n
ewRange.startLine;i<=newRange.endLine;++i) |
1331 if(this._dictionary){for(var i=newRange.startLine;i<=newRange.endLine;++i) | |
1332 linesToUpdate[i]=this.line(i);}}while(changeObject=changeObject.next);if(this._d
ictionary){for(var lineNumber in linesToUpdate) | 1354 linesToUpdate[i]=this.line(i);}}while(changeObject=changeObject.next);if(this._d
ictionary){for(var lineNumber in linesToUpdate) |
1333 this._addTextToCompletionDictionary(linesToUpdate[lineNumber]);} | 1355 this._addTextToCompletionDictionary(linesToUpdate[lineNumber]);} |
1334 if(singleCharInput) | 1356 if(singleCharInput) |
1335 this._autocompleteController.autocomplete();},_cursorActivity:function() | 1357 this._autocompleteController.autocomplete();},_cursorActivity:function() |
1336 {var start=this._codeMirror.getCursor("anchor");var end=this._codeMirror.getCurs
or("head");this._delegate.selectionChanged(this._toRange(start,end));if(!this._t
okenHighlighter.highlightedRegex()) | 1358 {var start=this._codeMirror.getCursor("anchor");var end=this._codeMirror.getCurs
or("head");this._delegate.selectionChanged(this._toRange(start,end));if(!this._t
okenHighlighter.highlightedRegex()) |
1337 this._codeMirror.operation(this._tokenHighlighter.highlightSelectedTokens.bind(t
his._tokenHighlighter));},_beforeSelectionChange:function(codeMirror,selection) | 1359 this._codeMirror.operation(this._tokenHighlighter.highlightSelectedTokens.bind(t
his._tokenHighlighter));},_beforeSelectionChange:function(codeMirror,selection) |
1338 {if(!this._isHandlingMouseDownEvent) | 1360 {if(!this._isHandlingMouseDownEvent) |
1339 return;this._reportJump(this.selection(),this._toRange(selection.anchor,selectio
n.head));},_reportJump:function(from,to) | 1361 return;this._reportJump(this.selection(),this._toRange(selection.anchor,selectio
n.head));},_reportJump:function(from,to) |
1340 {if(from&&to&&from.equal(to)) | 1362 {if(from&&to&&from.equal(to)) |
1341 return;this._delegate.onJumpToPosition(from,to);},_scroll:function() | 1363 return;this._delegate.onJumpToPosition(from,to);},_scroll:function() |
1342 {if(this._scrollTimer) | 1364 {if(this._scrollTimer) |
1343 clearTimeout(this._scrollTimer);var topmostLineNumber=this._codeMirror.lineAtHei
ght(this._codeMirror.getScrollInfo().top,"local");this._scrollTimer=setTimeout(t
his._delegate.scrollChanged.bind(this._delegate,topmostLineNumber),100);},_focus
:function() | 1365 clearTimeout(this._scrollTimer);var topmostLineNumber=this._codeMirror.lineAtHei
ght(this._codeMirror.getScrollInfo().top,"local");this._scrollTimer=setTimeout(t
his._delegate.scrollChanged.bind(this._delegate,topmostLineNumber),100);},_focus
:function() |
1344 {this._delegate.editorFocused();},_blur:function() | 1366 {this._delegate.editorFocused();},_blur:function() |
1345 {this._autocompleteController.finishAutocomplete();},scrollToLine:function(lineN
umber) | 1367 {this._autocompleteController.finishAutocomplete();},scrollToLine:function(lineN
umber) |
1346 {var pos=new CodeMirror.Pos(lineNumber,0);var coords=this._codeMirror.charCoords
(pos,"local");this._codeMirror.scrollTo(0,coords.top);},firstVisibleLine:functio
n() | 1368 {var pos=new CodeMirror.Pos(lineNumber,0);var coords=this._codeMirror.charCoords
(pos,"local");this._codeMirror.scrollTo(0,coords.top);},firstVisibleLine:functio
n() |
1347 {return this._codeMirror.lineAtHeight(this._codeMirror.getScrollInfo().top,"loca
l");},lastVisibleLine:function() | 1369 {return this._codeMirror.lineAtHeight(this._codeMirror.getScrollInfo().top,"loca
l");},lastVisibleLine:function() |
1348 {var scrollInfo=this._codeMirror.getScrollInfo();return this._codeMirror.lineAtH
eight(scrollInfo.top+scrollInfo.clientHeight,"local");},selection:function() | 1370 {var scrollInfo=this._codeMirror.getScrollInfo();return this._codeMirror.lineAtH
eight(scrollInfo.top+scrollInfo.clientHeight,"local");},selection:function() |
1349 {var start=this._codeMirror.getCursor("anchor");var end=this._codeMirror.getCurs
or("head");return this._toRange(start,end);},lastSelection:function() | 1371 {var start=this._codeMirror.getCursor("anchor");var end=this._codeMirror.getCurs
or("head");return this._toRange(start,end);},lastSelection:function() |
1350 {return this._lastSelection;},setSelection:function(textRange) | 1372 {return this._lastSelection;},setSelection:function(textRange) |
1351 {this._lastSelection=textRange;var pos=this._toPos(textRange);this._codeMirror.s
etSelection(pos.start,pos.end);},_detectLineSeparator:function(text) | 1373 {this._lastSelection=textRange;var pos=this._toPos(textRange);this._codeMirror.s
etSelection(pos.start,pos.end);},_detectLineSeparator:function(text) |
1352 {this._lineSeparator=text.indexOf("\r\n")>=0?"\r\n":"\n";},setText:function(text
) | 1374 {this._lineSeparator=text.indexOf("\r\n")>=0?"\r\n":"\n";},setText:function(text
) |
1353 {this._muteTextChangedEvent=true;this._codeMirror.setValue(text);this._updateEdi
torIndentation();if(this._shouldClearHistory){this._codeMirror.clearHistory();th
is._shouldClearHistory=false;} | 1375 {this._muteTextChangedEvent=true;if(text.length>WebInspector.CodeMirrorTextEdito
r.MaxEditableTextSize){if(this._dictionary) |
| 1376 this._dictionary.reset();this.setReadOnly(true);} |
| 1377 this._codeMirror.setValue(text);this._updateEditorIndentation();if(this._shouldC
learHistory){this._codeMirror.clearHistory();this._shouldClearHistory=false;} |
1354 this._detectLineSeparator(text);delete this._muteTextChangedEvent;},text:functio
n() | 1378 this._detectLineSeparator(text);delete this._muteTextChangedEvent;},text:functio
n() |
1355 {return this._codeMirror.getValue().replace(/\n/g,this._lineSeparator);},range:f
unction() | 1379 {return this._codeMirror.getValue().replace(/\n/g,this._lineSeparator);},range:f
unction() |
1356 {var lineCount=this.linesCount;var lastLine=this._codeMirror.getLine(lineCount-1
);return this._toRange(new CodeMirror.Pos(0,0),new CodeMirror.Pos(lineCount-1,la
stLine.length));},line:function(lineNumber) | 1380 {var lineCount=this.linesCount;var lastLine=this._codeMirror.getLine(lineCount-1
);return this._toRange(new CodeMirror.Pos(0,0),new CodeMirror.Pos(lineCount-1,la
stLine.length));},line:function(lineNumber) |
1357 {return this._codeMirror.getLine(lineNumber);},get linesCount() | 1381 {return this._codeMirror.getLine(lineNumber);},get linesCount() |
1358 {return this._codeMirror.lineCount();},setAttribute:function(line,name,value) | 1382 {return this._codeMirror.lineCount();},setAttribute:function(line,name,value) |
1359 {if(line<0||line>=this._codeMirror.lineCount()) | 1383 {if(line<0||line>=this._codeMirror.lineCount()) |
1360 return;var handle=this._codeMirror.getLineHandle(line);if(handle.attributes===un
defined)handle.attributes={};handle.attributes[name]=value;},getAttribute:functi
on(line,name) | 1384 return;var handle=this._codeMirror.getLineHandle(line);if(handle.attributes===un
defined)handle.attributes={};handle.attributes[name]=value;},getAttribute:functi
on(line,name) |
1361 {if(line<0||line>=this._codeMirror.lineCount()) | 1385 {if(line<0||line>=this._codeMirror.lineCount()) |
1362 return null;var handle=this._codeMirror.getLineHandle(line);return handle.attrib
utes&&handle.attributes[name]!==undefined?handle.attributes[name]:null;},removeA
ttribute:function(line,name) | 1386 return null;var handle=this._codeMirror.getLineHandle(line);return handle.attrib
utes&&handle.attributes[name]!==undefined?handle.attributes[name]:null;},removeA
ttribute:function(line,name) |
1363 {if(line<0||line>=this._codeMirror.lineCount()) | 1387 {if(line<0||line>=this._codeMirror.lineCount()) |
1364 return;var handle=this._codeMirror.getLineHandle(line);if(handle&&handle.attribu
tes) | 1388 return;var handle=this._codeMirror.getLineHandle(line);if(handle&&handle.attribu
tes) |
1365 delete handle.attributes[name];},_toPos:function(range) | 1389 delete handle.attributes[name];},_toPos:function(range) |
1366 {return{start:new CodeMirror.Pos(range.startLine,range.startColumn),end:new Code
Mirror.Pos(range.endLine,range.endColumn)}},_toRange:function(start,end) | 1390 {return{start:new CodeMirror.Pos(range.startLine,range.startColumn),end:new Code
Mirror.Pos(range.endLine,range.endColumn)}},_toRange:function(start,end) |
1367 {return new WebInspector.TextRange(start.line,start.ch,end.line,end.ch);},textEd
itorPositionHandle:function(lineNumber,columnNumber) | 1391 {return new WebInspector.TextRange(start.line,start.ch,end.line,end.ch);},textEd
itorPositionHandle:function(lineNumber,columnNumber) |
1368 {return new WebInspector.CodeMirrorPositionHandle(this._codeMirror,new CodeMirro
r.Pos(lineNumber,columnNumber));},__proto__:WebInspector.View.prototype} | 1392 {return new WebInspector.CodeMirrorPositionHandle(this._codeMirror,new CodeMirro
r.Pos(lineNumber,columnNumber));},__proto__:WebInspector.VBox.prototype} |
1369 WebInspector.CodeMirrorPositionHandle=function(codeMirror,pos) | 1393 WebInspector.CodeMirrorPositionHandle=function(codeMirror,pos) |
1370 {this._codeMirror=codeMirror;this._lineHandle=codeMirror.getLineHandle(pos.line)
;this._columnNumber=pos.ch;} | 1394 {this._codeMirror=codeMirror;this._lineHandle=codeMirror.getLineHandle(pos.line)
;this._columnNumber=pos.ch;} |
1371 WebInspector.CodeMirrorPositionHandle.prototype={resolve:function() | 1395 WebInspector.CodeMirrorPositionHandle.prototype={resolve:function() |
1372 {var lineNumber=this._codeMirror.getLineNumber(this._lineHandle);if(typeof lineN
umber!=="number") | 1396 {var lineNumber=this._codeMirror.getLineNumber(this._lineHandle);if(typeof lineN
umber!=="number") |
1373 return null;return{lineNumber:lineNumber,columnNumber:this._columnNumber};},equa
l:function(positionHandle) | 1397 return null;return{lineNumber:lineNumber,columnNumber:this._columnNumber};},equa
l:function(positionHandle) |
1374 {return positionHandle._lineHandle===this._lineHandle&&positionHandle._columnNum
ber==this._columnNumber&&positionHandle._codeMirror===this._codeMirror;}} | 1398 {return positionHandle._lineHandle===this._lineHandle&&positionHandle._columnNum
ber==this._columnNumber&&positionHandle._codeMirror===this._codeMirror;}} |
1375 WebInspector.CodeMirrorTextEditor.TokenHighlighter=function(codeMirror) | 1399 WebInspector.CodeMirrorTextEditor.TokenHighlighter=function(codeMirror) |
1376 {this._codeMirror=codeMirror;} | 1400 {this._codeMirror=codeMirror;} |
1377 WebInspector.CodeMirrorTextEditor.TokenHighlighter.prototype={highlightSearchRes
ults:function(regex,range) | 1401 WebInspector.CodeMirrorTextEditor.TokenHighlighter.prototype={highlightSearchRes
ults:function(regex,range) |
1378 {var oldRegex=this._highlightRegex;this._highlightRegex=regex;this._highlightRan
ge=range;if(this._searchResultMarker){this._searchResultMarker.clear();delete th
is._searchResultMarker;} | 1402 {var oldRegex=this._highlightRegex;this._highlightRegex=regex;this._highlightRan
ge=range;if(this._searchResultMarker){this._searchResultMarker.clear();delete th
is._searchResultMarker;} |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 return CodeMirror.Pass;codeMirror.setExtending(shift);codeMirror.execCommand("go
LineUp");codeMirror.execCommand("goLineEnd") | 1441 return CodeMirror.Pass;codeMirror.setExtending(shift);codeMirror.execCommand("go
LineUp");codeMirror.execCommand("goLineEnd") |
1418 codeMirror.setExtending(false);} | 1442 codeMirror.setExtending(false);} |
1419 function moveRight(shift,codeMirror) | 1443 function moveRight(shift,codeMirror) |
1420 {var cursor=codeMirror.getCursor("head");var line=codeMirror.getLine(cursor.line
);if(cursor.ch!==line.length||cursor.line+1===codeMirror.lineCount()) | 1444 {var cursor=codeMirror.getCursor("head");var line=codeMirror.getLine(cursor.line
);if(cursor.ch!==line.length||cursor.line+1===codeMirror.lineCount()) |
1421 return CodeMirror.Pass;codeMirror.setExtending(shift);codeMirror.execCommand("go
LineDown");codeMirror.execCommand("goLineStart");codeMirror.setExtending(false);
} | 1445 return CodeMirror.Pass;codeMirror.setExtending(shift);codeMirror.execCommand("go
LineDown");codeMirror.execCommand("goLineStart");codeMirror.setExtending(false);
} |
1422 function delWordBack(codeMirror) | 1446 function delWordBack(codeMirror) |
1423 {if(codeMirror.somethingSelected()) | 1447 {if(codeMirror.somethingSelected()) |
1424 return CodeMirror.Pass;var cursor=codeMirror.getCursor("head");if(cursor.ch===0) | 1448 return CodeMirror.Pass;var cursor=codeMirror.getCursor("head");if(cursor.ch===0) |
1425 codeMirror.execCommand("delCharBefore");else | 1449 codeMirror.execCommand("delCharBefore");else |
1426 return CodeMirror.Pass;} | 1450 return CodeMirror.Pass;} |
1427 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);ke
yMap[modifierKey+"-Backspace"]=delWordBack.bind(this);codeMirror.addKeyMap(keyMa
p);} | 1451 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);ke
yMap[modifierKey+"-Backspace"]=delWordBack;codeMirror.addKeyMap(keyMap);} |
1428 WebInspector.CodeMirrorTextEditor.AutocompleteController=function(textEditor,cod
eMirror) | 1452 WebInspector.CodeMirrorTextEditor.AutocompleteController=function(textEditor,cod
eMirror) |
1429 {this._textEditor=textEditor;this._codeMirror=codeMirror;this._codeMirror.on("sc
roll",this._onScroll.bind(this));this._codeMirror.on("cursorActivity",this._onCu
rsorActivity.bind(this));} | 1453 {this._textEditor=textEditor;this._codeMirror=codeMirror;this._codeMirror.on("sc
roll",this._onScroll.bind(this));this._codeMirror.on("cursorActivity",this._onCu
rsorActivity.bind(this));} |
1430 WebInspector.CodeMirrorTextEditor.AutocompleteController.prototype={autocomplete
:function() | 1454 WebInspector.CodeMirrorTextEditor.AutocompleteController.prototype={autocomplete
:function() |
1431 {var dictionary=this._textEditor._dictionary;if(!dictionary||this._codeMirror.so
methingSelected()){this.finishAutocomplete();return;} | 1455 {var dictionary=this._textEditor._dictionary;if(!dictionary||this._codeMirror.so
methingSelected()){this.finishAutocomplete();return;} |
1432 var cursor=this._codeMirror.getCursor();var substituteRange=this._textEditor._wo
rdRangeForCursorPosition(cursor.line,cursor.ch,false);if(!substituteRange||subst
ituteRange.startColumn===cursor.ch){this.finishAutocomplete();return;} | 1456 var cursor=this._codeMirror.getCursor();var substituteRange=this._textEditor._wo
rdRangeForCursorPosition(cursor.line,cursor.ch,false);if(!substituteRange||subst
ituteRange.startColumn===cursor.ch){this.finishAutocomplete();return;} |
1433 var prefixRange=substituteRange.clone();prefixRange.endColumn=cursor.ch;var subs
tituteWord=this._textEditor.copyRange(substituteRange);var hasPrefixInDictionary
=dictionary.hasWord(substituteWord);if(hasPrefixInDictionary) | 1457 var prefixRange=substituteRange.clone();prefixRange.endColumn=cursor.ch;var subs
tituteWord=this._textEditor.copyRange(substituteRange);var hasPrefixInDictionary
=dictionary.hasWord(substituteWord);if(hasPrefixInDictionary) |
1434 dictionary.removeWord(substituteWord);var wordsWithPrefix=dictionary.wordsWithPr
efix(this._textEditor.copyRange(prefixRange));if(hasPrefixInDictionary) | 1458 dictionary.removeWord(substituteWord);var wordsWithPrefix=dictionary.wordsWithPr
efix(this._textEditor.copyRange(prefixRange));if(hasPrefixInDictionary) |
1435 dictionary.addWord(substituteWord);function sortSuggestions(a,b) | 1459 dictionary.addWord(substituteWord);function sortSuggestions(a,b) |
1436 {return dictionary.wordCount(b)-dictionary.wordCount(a)||a.length-b.length;} | 1460 {return dictionary.wordCount(b)-dictionary.wordCount(a)||a.length-b.length;} |
1437 wordsWithPrefix.sort(sortSuggestions);if(!this._suggestBox){this._suggestBox=new
WebInspector.SuggestBox(this,this._textEditor.element,"generic-suggest",6);this
._anchorBox=this._anchorBoxForPosition(cursor.line,cursor.ch);} | 1461 wordsWithPrefix.sort(sortSuggestions);if(!this._suggestBox){this._suggestBox=new
WebInspector.SuggestBox(this,this._textEditor.element,"generic-suggest",6);this
._anchorBox=this._anchorBoxForPosition(cursor.line,cursor.ch);} |
1438 this._suggestBox.updateSuggestions(this._anchorBox,wordsWithPrefix,0,true,this._
textEditor.copyRange(prefixRange));this._prefixRange=prefixRange;if(!this._sugge
stBox.visible()) | 1462 this._suggestBox.updateSuggestions(this._anchorBox,wordsWithPrefix,0,true,this._
textEditor.copyRange(prefixRange));this._prefixRange=prefixRange;if(!this._sugge
stBox.visible()) |
1439 this.finishAutocomplete();},finishAutocomplete:function() | 1463 this.finishAutocomplete();},finishAutocomplete:function() |
1440 {if(!this._suggestBox) | 1464 {if(!this._suggestBox) |
1441 return;this._suggestBox.hide();this._suggestBox=null;this._prefixRange=null;this
._anchorBox=null;},keyDown:function(e) | 1465 return;this._suggestBox.hide();this._suggestBox=null;this._prefixRange=null;this
._anchorBox=null;},keyDown:function(e) |
1442 {if(!this._suggestBox) | 1466 {if(!this._suggestBox) |
1443 return false;if(e.keyCode===WebInspector.KeyboardShortcut.Keys.Esc.code){this.fi
nishAutocomplete();return true;} | 1467 return false;if(e.keyCode===WebInspector.KeyboardShortcut.Keys.Esc.code){this.fi
nishAutocomplete();return true;} |
1444 if(e.keyCode===WebInspector.KeyboardShortcut.Keys.Tab.code){this._suggestBox.acc
eptSuggestion();this.finishAutocomplete();return true;} | 1468 if(e.keyCode===WebInspector.KeyboardShortcut.Keys.Tab.code){this._suggestBox.acc
eptSuggestion();this.finishAutocomplete();return true;} |
1445 return this._suggestBox.keyPressed(e);},applySuggestion:function(suggestion,isIn
termediateSuggestion) | 1469 return this._suggestBox.keyPressed(e);},applySuggestion:function(suggestion,isIn
termediateSuggestion) |
1446 {this._currentSuggestion=suggestion;},acceptSuggestion:function() | 1470 {this._currentSuggestion=suggestion;},acceptSuggestion:function() |
1447 {if(this._prefixRange.endColumn-this._prefixRange.startColumn!==this._currentSug
gestion.length){var pos=this._textEditor._toPos(this._prefixRange);this._codeMir
ror.replaceRange(this._currentSuggestion,pos.start,pos.end,"+autocomplete");}},_
onScroll:function() | 1471 {if(this._prefixRange.endColumn-this._prefixRange.startColumn!==this._currentSug
gestion.length){var pos=this._textEditor._toPos(this._prefixRange);this._codeMir
ror.replaceRange(this._currentSuggestion,pos.start,pos.end,"+autocomplete");}},_
onScroll:function() |
1448 {if(!this._suggestBox) | 1472 {if(!this._suggestBox) |
1449 return;var cursor=this._codeMirror.getCursor();var scrollInfo=this._codeMirror.g
etScrollInfo();var topmostLineNumber=this._codeMirror.lineAtHeight(scrollInfo.to
p,"local");var bottomLine=this._codeMirror.lineAtHeight(scrollInfo.top+scrollInf
o.clientHeight,"local");if(cursor.line<topmostLineNumber||cursor.line>bottomLine
) | 1473 return;var cursor=this._codeMirror.getCursor();var scrollInfo=this._codeMirror.g
etScrollInfo();var topmostLineNumber=this._codeMirror.lineAtHeight(scrollInfo.to
p,"local");var bottomLine=this._codeMirror.lineAtHeight(scrollInfo.top+scrollInf
o.clientHeight,"local");if(cursor.line<topmostLineNumber||cursor.line>bottomLine
) |
1450 this.finishAutocomplete();else{this._anchorBox=this._anchorBoxForPosition(cursor
.line,cursor.ch);this._suggestBox.setPosition(this._anchorBox);}},_onCursorActiv
ity:function() | 1474 this.finishAutocomplete();else{this._anchorBox=this._anchorBoxForPosition(cursor
.line,cursor.ch);this._suggestBox.setPosition(this._anchorBox);}},_onCursorActiv
ity:function() |
1451 {if(!this._suggestBox) | 1475 {if(!this._suggestBox) |
1452 return;var cursor=this._codeMirror.getCursor();if(cursor.line!==this._prefixRang
e.startLine||cursor.ch>this._prefixRange.endColumn||cursor.ch<this._prefixRange.
startColumn) | 1476 return;var cursor=this._codeMirror.getCursor();if(cursor.line!==this._prefixRang
e.startLine||cursor.ch>this._prefixRange.endColumn||cursor.ch<this._prefixRange.
startColumn) |
1453 this.finishAutocomplete();},_anchorBoxForPosition:function(line,column) | 1477 this.finishAutocomplete();},_anchorBoxForPosition:function(line,column) |
1454 {var metrics=this._textEditor.cursorPositionToCoordinates(line,column);return me
trics?new AnchorBox(metrics.x,metrics.y,0,metrics.height):null;},} | 1478 {var metrics=this._textEditor.cursorPositionToCoordinates(line,column);return me
trics?new AnchorBox(metrics.x,metrics.y,0,metrics.height):null;},} |
| 1479 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens=function(modeN
ame,tokenPrefix) |
| 1480 {var oldModeName=modeName+"-old";if(CodeMirror.modes[oldModeName]) |
| 1481 return;CodeMirror.defineMode(oldModeName,CodeMirror.modes[modeName]);CodeMirror.
defineMode(modeName,modeConstructor);function modeConstructor(config,parserConfi
g) |
| 1482 {var innerConfig={};for(var i in parserConfig) |
| 1483 innerConfig[i]=parserConfig[i];innerConfig.name=oldModeName;var codeMirrorMode=C
odeMirror.getMode(config,innerConfig);codeMirrorMode.name=modeName;codeMirrorMod
e.token=tokenOverride.bind(null,codeMirrorMode.token);return codeMirrorMode;} |
| 1484 function tokenOverride(superToken,stream,state) |
| 1485 {var token=superToken(stream,state);return token?tokenPrefix+token:token;}} |
| 1486 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("css","css-");
WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("javascript","
js-");WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("xml","x
ml-");(function(){var backgroundColor=InspectorFrontendHost.getSelectionBackgrou
ndColor();var backgroundColorRule=backgroundColor?".CodeMirror .CodeMirror-selec
ted { background-color: "+backgroundColor+";}":"";var foregroundColor=InspectorF
rontendHost.getSelectionForegroundColor();var foregroundColorRule=foregroundColo
r?".CodeMirror .CodeMirror-selectedtext:not(.CodeMirror-persist-highlight) { col
or: "+foregroundColor+"!important;}":"";if(!foregroundColorRule&&!backgroundColo
rRule) |
| 1487 return;var style=document.createElement("style");style.textContent=backgroundCol
orRule+foregroundColorRule;document.head.appendChild(style);})(); |
OLD | NEW |