Skip to content

Commit 257121d

Browse files
authored
Merge pull request #1275 from tulinkry/scope-collapse
removing the ugly content jump on scope collapse
2 parents a59ac9a + 4558ad6 commit 257121d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/org/opensolaris/opengrok/analysis/JFlexXref.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,38 +479,42 @@ protected String htmlize(String raw) {
479479
protected void startNewLine() throws IOException {
480480
String iconId = null;
481481
int line = getLineNumber() + 1;
482+
boolean skipNl = false;
482483
setLineNumber(line);
483484

484485
if (scopesEnabled) {
485486
startScope();
486487

487488
if (scopeOpen && scope == null) {
488489
scopeOpen = false;
489-
out.write("</span>");
490+
out.write("\n</span>");
491+
skipNl = true;
490492
} else if (scope != null) {
491493
String scopeId = generateId(scope);
492494
if (scope.getLineFrom() == line) {
493-
out.write("<span id='");
495+
out.write("\n<span id='");
494496
out.write(scopeId);
495497
out.write("' class='scope-head'><span class='scope-signature'>");
496498
out.write(htmlize(scope.getName() + scope.getSignature()));
497499
out.write("</span>");
498500
iconId = scopeId + "_fold_icon";
501+
skipNl = true;
499502
} else if (scope.getLineFrom() == line - 1) {
500503
if (scopeOpen) {
501504
out.write("</span>");
502505
}
503506

504-
out.write("<span id='");
507+
out.write("\n<span id='");
505508
out.write(scopeId);
506509
out.write("_fold' class='scope-body'>");
510+
skipNl = true;
507511
}
508512
scopeOpen = true;
509513
}
510514
}
511515

512516
Util.readableLine(line, out, annotation, userPageLink, userPageSuffix,
513-
getProjectPostfix(true));
517+
getProjectPostfix(true), skipNl);
514518

515519
if (foldingEnabled && scopesEnabled) {
516520
if (iconId != null) {

0 commit comments

Comments
 (0)