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

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

Issue 1402193003: Pad line number appropriately when generating script insets. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 | no next file » | 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 92930a9eece56db3cb7c63e88fb68cde9ae1e31d..9900117fde3491fe223ed573c09a82ee3781c2ef 100644
--- a/runtime/observatory/lib/src/elements/script_inset.dart
+++ b/runtime/observatory/lib/src/elements/script_inset.dart
@@ -824,6 +824,11 @@ class ScriptInsetElement extends ObservatoryElement {
return table;
}
+ var endLine = (endPos != null
+ ? script.tokenToLine(endPos)
+ : script.lines.length + script.lineOffset);
+ var lineNumPad = endLine.toString().length;
+
annotationsCursor = 0;
int blankLineCount = 0;
@@ -840,17 +845,17 @@ class ScriptInsetElement extends ObservatoryElement {
if (blankLineCount < 4) {
// Too few blank lines for an elipsis.
for (int j = firstBlank; j <= lastBlank; j++) {
- table.append(lineElement(script.getLine(j)));
+ table.append(lineElement(script.getLine(j), lineNumPad));
}
} else {
// Add an elipsis for the skipped region.
- table.append(lineElement(script.getLine(firstBlank)));
- table.append(lineElement(null));
- table.append(lineElement(script.getLine(lastBlank)));
+ table.append(lineElement(script.getLine(firstBlank), lineNumPad));
+ table.append(lineElement(null, lineNumPad));
+ table.append(lineElement(script.getLine(lastBlank), lineNumPad));
}
blankLineCount = 0;
}
- table.append(lineElement(line));
+ table.append(lineElement(line, lineNumPad));
}
}
@@ -876,11 +881,11 @@ class ScriptInsetElement extends ObservatoryElement {
return annotation;
}
- Element lineElement(ScriptLine line) {
+ Element lineElement(ScriptLine line, int lineNumPad) {
var e = new DivElement();
e.classes.add("sourceRow");
e.append(lineBreakpointElement(line));
- e.append(lineNumberElement(line));
+ e.append(lineNumberElement(line, lineNumPad));
e.append(lineSourceElement(line));
return e;
}
@@ -952,9 +957,9 @@ class ScriptInsetElement extends ObservatoryElement {
return e;
}
- Element lineNumberElement(ScriptLine line) {
+ Element lineNumberElement(ScriptLine line, int lineNumPad) {
var lineNumber = line == null ? "..." : line.line;
- var e = span("$nbsp$lineNumber$nbsp");
+ var e = span("$nbsp${lineNumber.toString().padLeft(lineNumPad,nbsp)}$nbsp");
Cutch 2015/10/14 19:12:41 if (lineNumPad == null) { lineNumPad = 0; }
turnidge 2015/10/14 19:23:13 Resolved offline.
e.classes.add('noCopy');
if (lineNumber == _currentLine) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698