Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(395)

Unified Diff: runtime/observatory/lib/src/elements/script_inset.dart

Issue 849263002: Introduce elipses when there are long stretches of blank lines in observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/observatory/lib/src/elements/script_inset.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 814c45f61988a8e9b18b84bb7c6f26fca738a71b..f7a0627cc3e27921a3a588e477fec0f207e4b554 100644
--- a/runtime/observatory/lib/src/elements/script_inset.dart
+++ b/runtime/observatory/lib/src/elements/script_inset.dart
@@ -27,7 +27,8 @@ class ScriptInsetElement extends ObservatoryElement {
@observable int endLine;
@observable bool linesReady = false;
- @observable List<ScriptLine> lines = toObservable([]);
+ // Contents are either ScriptLine or ScriptElipsis.
+ @observable List lines = toObservable([]);
String makeLineId(int line) {
return 'line-$line';
@@ -112,8 +113,30 @@ class ScriptInsetElement extends ObservatoryElement {
: script.lines.length);
lines.clear();
+ int blankLineCount = 0;
for (int i = (startLine - 1); i <= (endLine - 1); i++) {
- lines.add(script.lines[i]);
+ if (script.lines[i].isBlank) {
+ // Try to introduce elipses if there are 4 or more contiguous blank lines.
+ blankLineCount++;
+ } else {
+ if (blankLineCount > 0) {
+ int firstBlank = i - blankLineCount;
+ int lastBlank = i - 1;
+ if (blankLineCount < 4) {
+ // Too few blank lines for an elipsis.
+ for (int j = firstBlank; j <= lastBlank; j++) {
+ lines.add(script.lines[j]);
+ }
+ } else {
+ // Add an elipsis for the skipped region.
+ lines.add(script.lines[firstBlank]);
+ lines.add(null);
+ lines.add(script.lines[lastBlank]);
+ }
+ blankLineCount = 0;
+ }
+ lines.add(script.lines[i]);
+ }
}
linesReady = true;
}
« no previous file with comments | « no previous file | runtime/observatory/lib/src/elements/script_inset.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698