From dbc2f75dc9ae2a832087bf8ce4d50564573fdc0a Mon Sep 17 00:00:00 2001 From: Bruce Zu Date: Sun, 21 Apr 2013 22:56:17 +0800 Subject: [PATCH] Enable expanding skipped lines even if 'Syntax Coloring' is off On SideBySide diff UI if 'Syntax Coloring' is disabled attempting to expand 'skipped common xx lines' will result in only one line displaying on the left side. Enabling 'Syntax Coloring' makes the expand work correctly on both sides. This issue has existed since v2.3, as the server was not including enough file content to support expanding the skipped regions. Change-Id: I6f33b21415746a54c0cdc507246c139b49cd045d --- .../client/patches/AbstractPatchContentTable.java | 10 +++++----- .../gerrit/httpd/rpc/patch/PatchScriptBuilder.java | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java index 20cc2c1dc1..8de3251bdf 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java @@ -292,17 +292,17 @@ public abstract class AbstractPatchContentTable extends NavigationTable protected SparseHtmlFile getSparseHtmlFileB(PatchScript s) { AccountDiffPreference dp = new AccountDiffPreference(s.getDiffPrefs()); + SparseFileContent b = s.getB(); PrettyFormatter f = ClientSideFormatter.FACTORY.get(); f.setDiffPrefs(dp); - f.setFileName(s.getB().getPath()); + f.setFileName(b.getPath()); f.setEditFilter(PrettyFormatter.B); f.setEditList(s.getEdits()); - if (dp.isSyntaxHighlighting() && s.getA().isWholeFile() && !s.getB().isWholeFile()) { - f.format(s.getB().apply(s.getA(), s.getEdits())); - } else { - f.format(s.getB()); + if (s.getA().isWholeFile() && !b.isWholeFile()) { + b = b.apply(s.getA(), s.getEdits()); } + f.format(b); return f; } diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchScriptBuilder.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchScriptBuilder.java index 816bbef6eb..502c9a39d0 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchScriptBuilder.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchScriptBuilder.java @@ -198,10 +198,10 @@ class PatchScriptBuilder { context = diffPrefs.getContext(); hugeFile = true; - } else if (diffPrefs.isSyntaxHighlighting()) { - // In order to syntax highlight the file properly we need to - // give the client the complete file contents. So force our - // context temporarily to the complete file size. + } else { + // In order to expand the skipped common lines or syntax highlight the + // file properly we need to give the client the complete file contents. + // So force our context temporarily to the complete file size. // context = MAX_CONTEXT; }