MCPcopy Index your code
hub / github.com/csev/py4e / updateSelection

Function updateSelection

tools/pythonauto/static/codemirror/codemirror.js:782–803  ·  view source on GitHub ↗
(cm)

Source from the content-addressed store, hash-verified

780 // SELECTION / CURSOR
781
782 function updateSelection(cm) {
783 var display = cm.display;
784 var collapsed = posEq(cm.doc.sel.from, cm.doc.sel.to);
785 if (collapsed || cm.options.showCursorWhenSelecting)
786 updateSelectionCursor(cm);
787 else
788 display.cursor.style.display = display.otherCursor.style.display = "none";
789 if (!collapsed)
790 updateSelectionRange(cm);
791 else
792 display.selectionDiv.style.display = "none";
793
794 // Move the hidden textarea near the cursor to prevent scrolling artifacts
795 if (cm.options.moveInputWithCursor) {
796 var headPos = cursorCoords(cm, cm.doc.sel.head, "div");
797 var wrapOff = getRect(display.wrapper), lineOff = getRect(display.lineDiv);
798 display.inputDiv.style.top = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
799 headPos.top + lineOff.top - wrapOff.top)) + "px";
800 display.inputDiv.style.left = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
801 headPos.left + lineOff.left - wrapOff.left)) + "px";
802 }
803 }
804
805 // No selection, plain cursor
806 function updateSelectionCursor(cm) {

Callers 2

updateDisplayFunction · 0.70
endOperationFunction · 0.70

Calls 5

updateSelectionCursorFunction · 0.85
updateSelectionRangeFunction · 0.85
getRectFunction · 0.85
posEqFunction · 0.70
cursorCoordsFunction · 0.70

Tested by

no test coverage detected