Chromium Code Reviews| Index: runtime/observatory/lib/src/elements/script_inset.dart |
| diff --git a/runtime/observatory/lib/src/elements/script_inset.dart b/runtime/observatory/lib/src/elements/script_inset.dart |
| index 1c158c0835c4236841d26b36d3908f93cad94679..fec390480c7dab2135cc9b82aceadda88e06ab7c 100644 |
| --- a/runtime/observatory/lib/src/elements/script_inset.dart |
| +++ b/runtime/observatory/lib/src/elements/script_inset.dart |
| @@ -382,6 +382,20 @@ class ScriptInsetElement extends ObservatoryElement { |
| Element linesTable() { |
| var table = new DivElement(); |
| table.classes.add("sourceTable"); |
| + table.onCopy.listen((event) { |
| + // Omit breakpoint indicators and line numbers when copying text by |
| + // marking them as hidden before the copy happens, then marking them |
| + // visible on the next event loop turn. |
| + var noCopyNodes = shadowRoot.getElementsByClassName("noCopy"); |
| + for(var node in noCopyNodes) { |
| + node.style.visibility = 'hidden'; |
| + } |
| + Timer.run(() { |
|
Cutch
2015/05/07 22:58:17
This is Timer.run is a beautiful hack. Could we fa
rmacnak
2015/05/08 19:58:18
Extracted as makeCssClassUncopyable.
|
| + for (var node in noCopyNodes) { |
| + node.style.visibility = 'visible'; |
| + } |
| + }); |
| + }); |
| annotationsCursor = 0; |
| @@ -449,6 +463,7 @@ class ScriptInsetElement extends ObservatoryElement { |
| var busy = false; |
| if (line == null || !line.possibleBpt) { |
| e.classes.add("emptyBreakpoint"); |
| + e.classes.add('noCopy'); |
| e.text = nbsp; |
| return e; |
| } |
| @@ -457,18 +472,22 @@ class ScriptInsetElement extends ObservatoryElement { |
| if (busy) { |
| e.classes.clear(); |
| e.classes.add("busyBreakpoint"); |
| + e.classes.add('noCopy'); |
| } else { |
| if (line.breakpoints != null) { |
| if (line.breakpointResolved) { |
| e.classes.clear(); |
| e.classes.add("resolvedBreakpoint"); |
| + e.classes.add('noCopy'); |
| } else { |
| e.classes.clear(); |
| e.classes.add("unresolvedBreakpoint"); |
| + e.classes.add('noCopy'); |
| } |
| } else { |
| e.classes.clear(); |
| e.classes.add("possibleBreakpoint"); |
|
Cutch
2015/05/07 22:58:17
every branch adds the class, why not move it to th
rmacnak
2015/05/08 19:58:18
Done.
|
| + e.classes.add('noCopy'); |
| } |
| } |
| } |
| @@ -504,6 +523,7 @@ class ScriptInsetElement extends ObservatoryElement { |
| Element lineNumberElement(ScriptLine line) { |
| var lineNumber = line == null ? "..." : line.line; |
| var e = span("$nbsp$lineNumber$nbsp"); |
| + e.classes.add('noCopy'); |
| if ((line == null) || (line.hits == null)) { |
| hitsUnknown(e); |
| @@ -553,6 +573,8 @@ class ScriptInsetElement extends ObservatoryElement { |
| consumeUntil(line.text.length); |
| } |
| + e.append(span('\n')); |
|
Cutch
2015/05/07 22:58:17
<br> ?
rmacnak
2015/05/08 19:58:18
No, this is here so blank lines are included when
|
| + |
| return e; |
| } |