| Index: third_party/WebKit/Source/devtools/front_end/cm/activeline.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/cm/activeline.js b/third_party/WebKit/Source/devtools/front_end/cm/activeline.js
|
| index b0b3f61af20c6faeb9ae3ab6f6622e3ae225e954..aa295d0d86c1550db10fe8bcdf88e0c80c9382c2 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/cm/activeline.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/cm/activeline.js
|
| @@ -1,12 +1,6 @@
|
| // CodeMirror, copyright (c) by Marijn Haverbeke and others
|
| // Distributed under an MIT license: http://codemirror.net/LICENSE
|
|
|
| -// Because sometimes you need to style the cursor's line.
|
| -//
|
| -// Adds an option 'styleActiveLine' which, when enabled, gives the
|
| -// active line's wrapping <div> the CSS class "CodeMirror-activeline",
|
| -// and gives its background <div> the class "CodeMirror-activeline-background".
|
| -
|
| (function(mod) {
|
| if (typeof exports == "object" && typeof module == "object") // CommonJS
|
| mod(require("../../lib/codemirror"));
|
| @@ -21,16 +15,18 @@
|
| var GUTT_CLASS = "CodeMirror-activeline-gutter";
|
|
|
| CodeMirror.defineOption("styleActiveLine", false, function(cm, val, old) {
|
| - var prev = old && old != CodeMirror.Init;
|
| - if (val && !prev) {
|
| - cm.state.activeLines = [];
|
| - updateActiveLines(cm, cm.listSelections());
|
| - cm.on("beforeSelectionChange", selectionChange);
|
| - } else if (!val && prev) {
|
| + var prev = old == CodeMirror.Init ? false : old;
|
| + if (val == prev) return
|
| + if (prev) {
|
| cm.off("beforeSelectionChange", selectionChange);
|
| clearActiveLines(cm);
|
| delete cm.state.activeLines;
|
| }
|
| + if (val) {
|
| + cm.state.activeLines = [];
|
| + updateActiveLines(cm, cm.listSelections());
|
| + cm.on("beforeSelectionChange", selectionChange);
|
| + }
|
| });
|
|
|
| function clearActiveLines(cm) {
|
| @@ -52,7 +48,9 @@
|
| var active = [];
|
| for (var i = 0; i < ranges.length; i++) {
|
| var range = ranges[i];
|
| - if (!range.empty()) continue;
|
| + var option = cm.getOption("styleActiveLine");
|
| + if (typeof option == "object" && option.nonEmpty ? range.anchor.line != range.head.line : !range.empty())
|
| + continue
|
| var line = cm.getLineHandleVisualStart(range.head.line);
|
| if (active[active.length - 1] != line) active.push(line);
|
| }
|
|
|