docs/assets/app.js
function drawSelectionRange(cm,range$$1,output){var display=cm.display,doc=cm.doc;var fragment=document.createDocumentFragment();var padding=paddingH(cm.display),leftSide=padding.left;var rightSide=Math.max(display.sizerWidth,displayWidth(cm)-display.sizer.offsetLeft)-padding.right;var docLTR=doc.direction=="ltr";function add(left,top,width,bottom){if(top<0){top=0;}top=Math.round(top);bottom=Math.round(bottom);fragment.appendChild(elt("div",null,"CodeMirror-selected","position: absolute; left: "+left+"px;\n                             top: "+top+"px; width: "+(width==null?rightSide-left:width)+"px;\n                             height: "+(bottom-top)+"px"));}function drawForLine(line,fromArg,toArg){var lineObj=getLine(doc,line);var lineLen=lineObj.text.length;var start,end;function coords(ch,bias){return _charCoords(cm,Pos(line,ch),"div",lineObj,bias);}function wrapX(pos,dir,side){var extent=wrappedLineExtentChar(cm,lineObj,null,pos);var prop=dir=="ltr"==(side=="after")?"left":"right";var ch=side=="after"?extent.begin:extent.end-(/\s/.test(lineObj.text.charAt(extent.end-1))?2:1);return coords(ch,prop)[prop];}var order=getOrder(lineObj,doc.direction);iterateBidiSections(order,fromArg||0,toArg==null?lineLen:toArg,function(from,to,dir,i){var ltr=dir=="ltr";var fromPos=coords(from,ltr?"left":"right");var toPos=coords(to-1,ltr?"right":"left");var openStart=fromArg==null&&from==0,openEnd=toArg==null&&to==lineLen;var first=i==0,last=!order||i==order.length-1;if(toPos.top-fromPos.top<=3){// Single line
var openLeft=(docLTR?openStart:openEnd)&&first;var openRight=(docLTR?openEnd:openStart)&&last;var left=openLeft?leftSide:(ltr?fromPos:toPos).left;var right=openRight?rightSide:(ltr?toPos:fromPos).right;add(left,fromPos.top,right-left,fromPos.bottom);}else{// Multiple lines
var topLeft,topRight,botLeft,botRight;if(ltr){topLeft=docLTR&&openStart&&first?leftSide:fromPos.left;topRight=docLTR?rightSide:wrapX(from,dir,"before");botLeft=docLTR?leftSide:wrapX(to,dir,"after");botRight=docLTR&&openEnd&&last?rightSide:toPos.right;}else{topLeft=!docLTR?leftSide:wrapX(from,dir,"before");topRight=!docLTR&&openStart&&first?rightSide:fromPos.right;botLeft=!docLTR&&openEnd&&last?leftSide:toPos.left;botRight=!docLTR?rightSide:wrapX(to,dir,"after");}add(topLeft,fromPos.top,topRight-topLeft,fromPos.bottom);if(fromPos.bottom<toPos.top){add(leftSide,fromPos.bottom,null,toPos.top);}add(botLeft,toPos.top,botRight-botLeft,toPos.bottom);}if(!start||cmpCoords(fromPos,start)<0){start=fromPos;}if(cmpCoords(toPos,start)<0){start=toPos;}if(!end||cmpCoords(fromPos,end)<0){end=fromPos;}if(cmpCoords(toPos,end)<0){end=toPos;}});return{start:start,end:end};}var sFrom=range$$1.from(),sTo=range$$1.to();if(sFrom.line==sTo.line){drawForLine(sFrom.line,sFrom.ch,sTo.ch);}else{var fromLine=getLine(doc,sFrom.line),toLine=getLine(doc,sTo.line);var singleVLine=visualLine(fromLine)==visualLine(toLine);var leftEnd=drawForLine(sFrom.line,sFrom.ch,singleVLine?fromLine.text.length+1:null).end;var rightStart=drawForLine(sTo.line,singleVLine?0:null,sTo.ch).start;if(singleVLine){if(leftEnd.top<rightStart.top-2){add(leftEnd.right,leftEnd.top,null,leftEnd.bottom);add(leftSide,rightStart.top,rightStart.left,rightStart.bottom);}else{add(leftEnd.right,leftEnd.top,rightStart.left-leftEnd.right,leftEnd.bottom);}}if(leftEnd.bottom<rightStart.top){add(leftSide,leftEnd.bottom,null,rightStart.top);}}output.appendChild(fragment);}
function drawSelectionRange(cm,range$$1,output){var display=cm.display,doc=cm.doc;var fragment=document.createDocumentFragment();var padding=paddingH(cm.display),leftSide=padding.left;var rightSide=Math.max(display.sizerWidth,displayWidth(cm)-display.sizer.offsetLeft)-padding.right;var docLTR=doc.direction=="ltr";function add(left,top,width,bottom){if(top<0){top=0;}top=Math.round(top);bottom=Math.round(bottom);fragment.appendChild(elt("div",null,"CodeMirror-selected","position: absolute; left: "+left+"px;\n                             top: "+top+"px; width: "+(width==null?rightSide-left:width)+"px;\n                             height: "+(bottom-top)+"px"));}function drawForLine(line,fromArg,toArg){var lineObj=getLine(doc,line);var lineLen=lineObj.text.length;var start,end;function coords(ch,bias){return _charCoords(cm,Pos(line,ch),"div",lineObj,bias);}function wrapX(pos,dir,side){var extent=wrappedLineExtentChar(cm,lineObj,null,pos);var prop=dir=="ltr"==(side=="after")?"left":"right";var ch=side=="after"?extent.begin:extent.end-(/\s/.test(lineObj.text.charAt(extent.end-1))?2:1);return coords(ch,prop)[prop];}var order=getOrder(lineObj,doc.direction);iterateBidiSections(order,fromArg||0,toArg==null?lineLen:toArg,function(from,to,dir,i){var ltr=dir=="ltr";var fromPos=coords(from,ltr?"left":"right");var toPos=coords(to-1,ltr?"right":"left");var openStart=fromArg==null&&from==0,openEnd=toArg==null&&to==lineLen;var first=i==0,last=!order||i==order.length-1;if(toPos.top-fromPos.top<=3){// Single line
var openLeft=(docLTR?openStart:openEnd)&&first;var openRight=(docLTR?openEnd:openStart)&&last;var left=openLeft?leftSide:(ltr?fromPos:toPos).left;var right=openRight?rightSide:(ltr?toPos:fromPos).right;add(left,fromPos.top,right-left,fromPos.bottom);}else{// Multiple lines
var topLeft,topRight,botLeft,botRight;if(ltr){topLeft=docLTR&&openStart&&first?leftSide:fromPos.left;topRight=docLTR?rightSide:wrapX(from,dir,"before");botLeft=docLTR?leftSide:wrapX(to,dir,"after");botRight=docLTR&&openEnd&&last?rightSide:toPos.right;}else{topLeft=!docLTR?leftSide:wrapX(from,dir,"before");topRight=!docLTR&&openStart&&first?rightSide:fromPos.right;botLeft=!docLTR&&openEnd&&last?leftSide:toPos.left;botRight=!docLTR?rightSide:wrapX(to,dir,"after");}add(topLeft,fromPos.top,topRight-topLeft,fromPos.bottom);if(fromPos.bottom<toPos.top){add(leftSide,fromPos.bottom,null,toPos.top);}add(botLeft,toPos.top,botRight-botLeft,toPos.bottom);}if(!start||cmpCoords(fromPos,start)<0){start=fromPos;}if(cmpCoords(toPos,start)<0){start=toPos;}if(!end||cmpCoords(fromPos,end)<0){end=fromPos;}if(cmpCoords(toPos,end)<0){end=toPos;}});return{start:start,end:end};}var sFrom=range$$1.from(),sTo=range$$1.to();if(sFrom.line==sTo.line){drawForLine(sFrom.line,sFrom.ch,sTo.ch);}else{var fromLine=getLine(doc,sFrom.line),toLine=getLine(doc,sTo.line);var singleVLine=visualLine(fromLine)==visualLine(toLine);var leftEnd=drawForLine(sFrom.line,sFrom.ch,singleVLine?fromLine.text.length+1:null).end;var rightStart=drawForLine(sTo.line,singleVLine?0:null,sTo.ch).start;if(singleVLine){if(leftEnd.top<rightStart.top-2){add(leftEnd.right,leftEnd.top,null,leftEnd.bottom);add(leftSide,rightStart.top,rightStart.left,rightStart.bottom);}else{add(leftEnd.right,leftEnd.top,rightStart.left-leftEnd.right,leftEnd.bottom);}}if(leftEnd.bottom<rightStart.top){add(leftSide,leftEnd.bottom,null,rightStart.top);}}output.appendChild(fragment);}
function drawSelectionRange ( cm , range$$1 , output ) { var display = cm . display , doc = cm . doc ; var fragment = document . createDocumentFragment ( ) ; var padding = paddingH ( cm . display ) , leftSide = padding . left ; var rightSide = Math . max ( display . sizerWidth , displayWidth ( cm ) - display . sizer . offsetLeft ) - padding . right ; var docLTR = doc . direction == "ltr" ; function add ( left , top , width , bottom ) { if ( top < 0 ) { top = 0 ; } top = Math . round ( top ) ; bottom = Math . round ( bottom ) ; fragment . appendChild ( elt ( "div" , null , "CodeMirror-selected" , "position: absolute; left: " + left + "px;\n                             top: " + top + "px; width: " + ( width == null ? rightSide - left : width ) + "px;\n                             height: " + ( bottom - top ) + "px" ) ) ; } function drawForLine ( line , fromArg , toArg ) { var lineObj = getLine ( doc , line ) ; var lineLen = lineObj . text . length ; var start , end ; function coords ( ch , bias ) { return _charCoords ( cm , Pos ( line , ch ) , "div" , lineObj , bias ) ; } function wrapX ( pos , dir , side ) { var extent = wrappedLineExtentChar ( cm , lineObj , null , pos ) ; var prop = dir == "ltr" == ( side == "after" ) ? "left" : "right" ; var ch = side == "after" ? extent . begin : extent . end - ( / \s / . test ( lineObj . text . charAt ( extent . end - 1 ) ) ? 2 : 1 ) ; return coords ( ch , prop ) [ prop ] ; } var order = getOrder ( lineObj , doc . direction ) ; iterateBidiSections ( order , fromArg || 0 , toArg == null ? lineLen : toArg , function ( from , to , dir , i ) { var ltr = dir == "ltr" ; var fromPos = coords ( from , ltr ? "left" : "right" ) ; var toPos = coords ( to - 1 , ltr ? "right" : "left" ) ; var openStart = fromArg == null && from == 0 , openEnd = toArg == null && to == lineLen ; var first = i == 0 , last = ! order || i == order . length - 1 ; if ( toPos . top - fromPos . top <= 3 ) { // Single line var openLeft = ( docLTR ? openStart : openEnd ) && first ; var openRight = ( docLTR ? openEnd : openStart ) && last ; var left = openLeft ? leftSide : ( ltr ? fromPos : toPos ) . left ; var right = openRight ? rightSide : ( ltr ? toPos : fromPos ) . right ; add ( left , fromPos . top , right - left , fromPos . bottom ) ; } else { // Multiple lines var topLeft , topRight , botLeft , botRight ; if ( ltr ) { topLeft = docLTR && openStart && first ? leftSide : fromPos . left ; topRight = docLTR ? rightSide : wrapX ( from , dir , "before" ) ; botLeft = docLTR ? leftSide : wrapX ( to , dir , "after" ) ; botRight = docLTR && openEnd && last ? rightSide : toPos . right ; } else { topLeft = ! docLTR ? leftSide : wrapX ( from , dir , "before" ) ; topRight = ! docLTR && openStart && first ? rightSide : fromPos . right ; botLeft = ! docLTR && openEnd && last ? leftSide : toPos . left ; botRight = ! docLTR ? rightSide : wrapX ( to , dir , "after" ) ; } add ( topLeft , fromPos . top , topRight - topLeft , fromPos . bottom ) ; if ( fromPos . bottom < toPos . top ) { add ( leftSide , fromPos . bottom , null , toPos . top ) ; } add ( botLeft , toPos . top , botRight - botLeft , toPos . bottom ) ; } if ( ! start || cmpCoords ( fromPos , start ) < 0 ) { start = fromPos ; } if ( cmpCoords ( toPos , start ) < 0 ) { start = toPos ; } if ( ! end || cmpCoords ( fromPos , end ) < 0 ) { end = fromPos ; } if ( cmpCoords ( toPos , end ) < 0 ) { end = toPos ; } } ) ; return { start : start , end : end } ; } var sFrom = range$$1 . from ( ) , sTo = range$$1 . to ( ) ; if ( sFrom . line == sTo . line ) { drawForLine ( sFrom . line , sFrom . ch , sTo . ch ) ; } else { var fromLine = getLine ( doc , sFrom . line ) , toLine = getLine ( doc , sTo . line ) ; var singleVLine = visualLine ( fromLine ) == visualLine ( toLine ) ; var leftEnd = drawForLine ( sFrom . line , sFrom . ch , singleVLine ? fromLine . text . length + 1 : null ) . end ; var rightStart = drawForLine ( sTo . line , singleVLine ? 0 : null , sTo . ch ) . start ; if ( singleVLine ) { if ( leftEnd . top < rightStart . top - 2 ) { add ( leftEnd . right , leftEnd . top , null , leftEnd . bottom ) ; add ( leftSide , rightStart . top , rightStart . left , rightStart . bottom ) ; } else { add ( leftEnd . right , leftEnd . top , rightStart . left - leftEnd . right , leftEnd . bottom ) ; } } if ( leftEnd . bottom < rightStart . top ) { add ( leftSide , leftEnd . bottom , null , rightStart . top ) ; } } output . appendChild ( fragment ) ; }
Draws the given range as a highlighted selection
Draws the given range as a highlighted selection