@@ -249,7 +249,25 @@ define(function (require, exports, module) {
249249 }
250250 }
251251 }
252-
252+
253+ /**
254+ * @private
255+ * Handle any cursor movement in editor, including selecting and unselecting text.
256+ * @param {jQueryObject } jqEvent jQuery event object
257+ * @param {Editor } editor Current, focused editor (main or inline)
258+ * @param {!Event } event
259+ */
260+ function _handleCursorActivity ( jqEvent , editor , event ) {
261+ // If there is a selection in the editor, temporarily hide Active Line Highlight
262+ if ( editor . hasSelection ( ) ) {
263+ if ( editor . _codeMirror . getOption ( "styleActiveLine" ) ) {
264+ editor . _codeMirror . setOption ( "styleActiveLine" , false ) ;
265+ }
266+ } else {
267+ editor . _codeMirror . setOption ( "styleActiveLine" , _styleActiveLine ) ;
268+ }
269+ }
270+
253271 function _handleKeyEvents ( jqEvent , editor , event ) {
254272 _checkElectricChars ( jqEvent , editor , event ) ;
255273
@@ -382,6 +400,7 @@ define(function (require, exports, module) {
382400 this . _installEditorListeners ( ) ;
383401
384402 $ ( this )
403+ . on ( "cursorActivity" , _handleCursorActivity )
385404 . on ( "keyEvent" , _handleKeyEvents )
386405 . on ( "change" , this . _handleEditorChange . bind ( this ) ) ;
387406
@@ -1550,10 +1569,15 @@ define(function (require, exports, module) {
15501569 /**
15511570 * Sets show active line option and reapply it to all open editors.
15521571 * @param {boolean } value
1572+ * @param {Editor } editor Current, focused editor (main or inline)
15531573 */
1554- Editor . setShowActiveLine = function ( value ) {
1574+ Editor . setShowActiveLine = function ( value , editor ) {
15551575 _styleActiveLine = value ;
15561576 _setEditorOptionAndPref ( value , "styleActiveLine" , "styleActiveLine" ) ;
1577+
1578+ if ( editor . hasSelection ( ) ) {
1579+ editor . _codeMirror . setOption ( "styleActiveLine" , false ) ;
1580+ }
15571581 } ;
15581582
15591583 /** @type {boolean } Returns true if show active line is enabled for all editors */
0 commit comments